Click here to Skip to main content
15,891,513 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I'm facing a wired problem when using asp.net 4.5 membership to manage forms authentication for my users.

The first page i request after login works fine, but when i try to move to another page or even refresh the current page, i get redirected to login page, even though forms timeout was not reached.

I use the following code when users login


C#
if (Membership.ValidateUser(txtEmail.Text, txtPassword.Text))
{
   FormsAuthentication.SetAuthCookie(txtEmail.Text,false);
   Response.Redirect("~/en/pages/");
}


And there is no codes to check if user is logged in inside page or master page, just the traditional web.config settings as follows:

<authorization>                    
   <allow roles="Employee" />
   <deny users="*" />
</authorization>



Thanks in advance.
Posted
Comments
ZurdoDev 10-Dec-13 7:38am    
Try FormsAuthentication.RedirectFromLoginPage(); instead of Response.Redirect
WaleedMuh 11-Dec-13 9:15am    
I tried this and its the same.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900