I am using built-in asp.net Roles and membership provider in my website.
what i want to restrict all user who is in role "Nurse" from page n开发者_C百科ame
doctorDiscussionBoard.aspx
.
help me how to do it.
i guess we will write the code in Page load method.
You can do it like you suggest:
if (User.IsInRole("Nurse"))
//Redirect
That method is in the System.Security.Principal
namespace.
You can also do it in the web.config:
<configuration>
<location path="doctorDiscussionBoard.aspx">
<system.web>
<authorization>
<deny roles="Nurses" />
<allow roles="Doctors" />
<deny users="*" />
</authorization>
</system.web>
</location>
....
精彩评论