How do you do role based security ?

Answer Posted / narayansahu

1.Create a principle object which contains users identity
(login name) and array of roles
2.and pass this object to HttpContext.Current.User
3.The roles supplied to this object will be checked against
roles specified in the web.config file,if they matched then
they are allowed access to the page otherwise not.

allowed roles can be specified like this in web.config
<authorization>
<allow roles="Administrator,CanEdit"/>
<deny users="*" />
</authorization>

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why we need a separate mobile project template, while we can render our web application in mobile ?

677


Are there any parts of the .net framework 3.0 that only work on windows vista?

671


Can I add asp.net mvc testcases in visual studio express?

704


If I have multiple filters implemented, what is the order in which these filters get executed?

622


What is .net framework & its benefits?

607






How route table is created in ASP.NET MVC?

692


Briefly describe the roles of clr in .net framework?

636


What is stateless model?

597


what is use of entitydatasource control?

712


What are Action Filters in ASP.NET MVC and its use?

658


What is the .net framework and how does it work?

642


How we can add the css in mvc?

684


What are authentication filters in web api?

650


What is viewstart page in mvc?

667


What operating systems will the .net framework 3.0 be available for?

649