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

What are scaffold templates in mvc?

0 Answers  


What is a serverside technology? what is a clientside technology? what is a clientserver technology? what is a internet based application? what is a intranet based application? what is a windows application? what is a console application? Difference between console application and windows application?

4 Answers   IBM,


If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?

0 Answers   Cap Gemini,


What is the use .Glimpse in ASP.Net MVC

0 Answers   B-Ways TecnoSoft,


What is GUID and why we need to use it and in what condition? How this is created

1 Answers  






What is partialview in asp.net mvc?

0 Answers  


What is the full form of sp?

0 Answers  


Explain encapsulation

1 Answers   HPCL, Hughes Systique Corporation,


What are the levels at which filters can be applied in an asp.net mvc application?

0 Answers   NA,


What are the two ways to add constraints to a route?

0 Answers  


What you mean by routing in asp.net mvc?

0 Answers  


what is deferred loading(lazy loading)?

0 Answers   Microsoft,


Categories