I have a login screen that requires a username/password.
I am using ASP.NET's Membership and Role tables that is part of ASP.NET to store info when the user initially registered.
Once the user logs in with the appropriate role, then direct them to another page.
Here is the web.config file for the that other page. Note that it only allows role of SomeRole.
<configuration>
<system.web>
<authorization>
<allow roles="SomeRole" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
In the login screen, I capture the username, password. I am not sure though how to make the following be the user's role.
I have the following code:
protected void btnLogin_Click(object sender, EventArgs e)
{
// not sure what code to put here so user logged in that has a Role of SomeRole works with code just below
if (User.IsInRole("SomeRole"))
When I look to see, User's role shows up as blank. My question is, how do I make the current that is logged in have role of SomeRole so that
<allow roles="SomeRole" />
will work. Note that on the login screen, I have a user name and password that belongs to SomeRole but not sure how to make
if (User.IsInRole("SomeRole")) work so that inherit's that user's role. Hope this make sense.
Here is what my web.config looks like:
<roleManager enabled="true" cacheRolesInCookie="true"
defaultProvider="SiRoleProvider"
createPersistentCookie="false"
cookieProtection="All">
<providers>
<clear/>
<add connectionStringName="SiiSQL1" applicationName="SiGen" name=" r" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>
Thanks