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
My organization went through the approval process of supporting the .net framework 2.0 in production. Do we need to go through the same process all over again for the .net framework 3.0? Do I need to do any application compatibility testing for my .net framework 2.0 applications?
What are the difference between asynchronous controller implementation between asp.net mvc 3 & asp.net mvc 4?
How to update one of my table in database at 4pm every day how it is possible?
What are the 3 main components of an asp.net mvc application?
What is routeconfig.cs in mvc 4?
Why is the .net framework 3.0 a major version number of the .net framework if it uses the .net framework 2.0 runtime and compiler?
Describe the .net framework architecture.
mention what is csdl, ssdl and msl sections in an edmx file?
what is entity framework?
What is .net framework used for?
what is deferred loading(lazy loading)?
What are Non Action methods in ASP.Net MVC?
What is the importance of NonActionAttribute?
List the new features added in .net framework 4.0.
What is main objective of asp.net mvc 4 or what is new in mvc4 ?