In my ASP.NET web application, the project structure is displayed as follows:

Web.config Site has form authentication:
<authentication mode="Forms">
<forms loginUrl="~/Login.aspx" timeout="2880" />
</authentication>
And the Web.config folder in the Pages folder:
<?xml version="1.0"?>
<configuration>
<system.web>
<authorization>
<allow roles="Admin"/>
<deny users="*"/>
</authorization>
</system.web>
I have a user admin with the admin role. After a successful login, I try to redirect the user to Home.aspx in the Pages folder:
protected void EMSLogin_Authenticate(object sender, AuthenticateEventArgs e) {
TextBox UserNameTextBox = EMSLogin.FindControl("UserName") as TextBox;
TextBox PasswordTextBox = EMSLogin.FindControl("Password") as TextBox;
if (Membership.ValidateUser(UserNameTextBox.Text, PasswordTextBox.Text)) {
Response.Redirect("~/Pages/Home.aspx");
}
}
But it does not work. Again, he is redirected to the login page, that is Login.aspx are URL-address: localhost:3695/Login.aspx?ReturnUrl=%2fPages%2fHome.aspx.
How can i achieve this? Any information would be very helpful.
Sincerely.
source
share