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

What is the use of view model in asp.net mvc?

683


What are the main features of asp.net mvc 4 used by asp.net web api?

549


In razor syntax, what is the escape sequence character for @ symbol?

560


Explain the new features 3.5 framework against with the tool?

503


What is entitytype? : Entity framework

530






what is ssdl?

678


Where are the routing rules defined in an asp.net mvc application?

542


What is a model in programming?

553


Is razor a server side?

526


how do you mark a property as required? For example, for a project, the name is a required field.

582


explain how you can load related entities in ef (entity framework)?

544


what is more complex to implement property, methods or event? how can I define criteria to compare the difficulty of implementation between them? for example the number of methods wanted to implements property is 2 methods. how many methods I need it to implements events?

1690


How does work clr?

535


What are the new features 3.5 framework against with the tool?

542


What are Model Binders in ASP.Net MVC?

691