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
Is it possible to unit test an mvc application without running the controllers in an asp.net process?
Does Tempdata hold the data for other request in ASP.Net MVC?
What are authentication filters in web api?
Do you know about the new features in asp.net mvc 4 (asp.net mvc4)?
will there be any issues adding a table without primary keys to a data model?
What is representational state transfer (rest) mean?
Explain the new features 3.5 framework against with the tool?
What is ado.net data provider? : Entity framework
What are the main features of asp.net mvc 4 used by asp.net web api?
What is the difference between partial and renderpartial?
what is entity sql?
What is meant by tempdata in mvc?
Which approach provides better support for test driven development - asp.net mvc or asp.net webforms?
What is entity sql? : Entity framework
What is latest version of .net framework?