I have a problem with asp.net membership authorization, I configured my main web config like this:
<connectionStrings>
<add name="xxx" connectionString="Data Source=; Initial Catalog=; Integrated Security=;" providerName="System.Data.SqlClient" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer"
connectionString="Data Source=; Initial Catalog=; Integrated Security=;"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<roleManager enabled="true" defaultProvider="MyProvider">
<providers>
<add name="MyProvider"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="Devices"
applicationName="MembersTable" />
</providers>
</roleManager>
<membership defaultProvider="MyProvider">
<providers>
<add name="MyProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="" />
</providers>
</membership>
<authentication mode="Forms">
<forms loginUrl="Denied.aspx" name=".ASPXFORMSAUTH"/>
</authentication>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>`
and in specified folder my config looks like
<configuration>
<location>
<system.web>
<authorization>
<allow roles="role1"/>
<deny users="*" />
</authorization>
</system.web>
</location>
</configuration>
But after login I dont get access to folder files , it returns me on Denied.aspx
page
I verify user with Membership.ValidateUser
method and call page with Response.Redirect
. Is this enough or I need a different way of requesting protected page
if (
Membership.ValidateUser(this.txtUsername.Text, this.txtPassword.Text))
{
Response.Redirect("/tempUser/Role1Page.aspx");
}
else {
Response.Redirect("Denied.aspx");
}