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
Can you please explain the request flow in ASP.NET MVC framework?
Explain unit test done by tester on development team?
How do I use partial view?
How do you handle variable number of segments in a route definition?
explain how you can load related entities in ef (entity framework)?
what is conceptual model?
explain lazy loading, eager loading, and explicit loading?
Can a view be shared across multiple controllers? If yes, how we can do that?
What is the need of Action Filters in ASP.Net MVC
What is Separation of Concerns in ASP.NET ASP.Net MVC?
Does Tempdata hold the data for other request in ASP.Net MVC?
Explain the new features 3.5 framework against with the tool?
What is attribute routing in mvc?
How we can register the Area in ASP.Net MVC?
Where are the routing rules defined in an asp.net mvc application?