How do you do role based security ?



How do you do role based security ?..

Answer / 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

More Dot Net Framework Interview Questions

please tell me the best book of asp.net in the markit. which explain in simple and detail.

4 Answers  


What is the use of the default route {resource}.axd/{*pathinfo} ?

0 Answers  


Can you handle all button click events at once in a form? Give coding.

1 Answers   Kanbay,


can we call the garbage collector to run explicicitly?

6 Answers   Kanbay, Volvo,


What are the 3 main components of an asp.net mvc application?

0 Answers  






What are scaffold templates in mvc?

0 Answers  


What is strong name and which tool is used for this ?

4 Answers   Accenture, BirlaSoft,


What are the sub types of ActionResult?

0 Answers  


How to make sure Client Validation is enabled in ASP.Net MVC

0 Answers   B-Ways TecnoSoft,


What is the property available to check if the page posted or not

1 Answers  


What is the difference between .net core and .net framework?

0 Answers  


About Assembly in .NET, types of assemblies, their difference, How to register into GAC. How to generate the strong names & its use ?

6 Answers   Infosys, Microsoft, MMTS,


Categories