Note that there are some explanatory texts on larger screens.

plurals
  1. POauthorized users cannot access their page
    primarykey
    data
    text
    <p>I have a application that authenticates a particular user(East) and redirects them to their respective page(East.aspx).This page cannot be displayed to un-authorized users, whenever they go to the authorized page(East.aspx) they are re-directed to the login page.</p> <p>To solve the above problem I have created roles and added users to a particular role in Application file(Global.asax) in Application_Start Event.</p> <pre><code>void Application_Start(object sender, EventArgs e) { // Code that runs on application startup if (Roles.RoleExists("Browser") == false) { Roles.CreateRole("Browser"); Roles.AddUserToRole("East","Browser"); } if (Roles.RoleExists("Buyer") == false) { Roles.CreateRole("Buyer"); Roles.AddUserToRole("B2","Buyer"); } if (Roles.RoleExists("Seller") == false) { Roles.CreateRole("Seller"); Roles.AddUserToRole("S1","Seller"); } if (Roles.RoleExists("Admin") == false) { Roles.CreateRole("Admin"); Roles.AddUserToRole("A1","Admin"); } } </code></pre> <p>In web.Config file I implemented following</p> <p> </p> <pre><code>&lt;/authorization&gt; &lt;roleManager enabled="true" defaultProvider="SqlRoleManager"&gt; &lt;providers&gt; &lt;clear/&gt; &lt;add name="SqlRoleManager" type="System.Web.Security.SqlRoleProvider" connectionStringName="MyDbConn" applicationName="RolebasedApp"/&gt; &lt;add applicationName="RolebasedApp" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider"/&gt; &lt;/providers&gt; &lt;/roleManager&gt; &lt;/system.web&gt; </code></pre> <p> </p> <p>I'm testing the above case for only East User.I want to make sure that my Application name is (the application name where I start creating the Web pages for different users).</p> <p>When all of this is done, when I run my application And enter the correct credentials for User "East". I get Navigated to Login page instead of East.aspx</p> <p>How can this be solved?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload