Lost Cookie during Authentication

  • Thread starter Thread starter yofnik
  • Start date Start date
Y

yofnik

Hello All,
I am going crazy trying to figure out why my ASP.NET web application
cannot get beyond the login screen. It is using very simple Forms based
authentication that works fine in my development environment:

if(!FormsAuthentication.Authen­ticate(tbUserName.Value,
tbPassword.Value))
{
pageInfo.Text = "Invalid user name or password. Please try again.";
}
else
{
FormsAuthentication.RedirectFr­omLoginPage(tbUserName.Value,
false);
}

If the username and password are wrong, the Authentication fails as
expected and the error message is displayed. If the credentials are
correct, the Redirect does not happen and it returns to the login page.
After turning Tracing on, I noticed that the authentication cookie is
not getting saved. It gets created after the Login POST, but then the
next page, the cookie is gone and the application redirects back to the
login page because it thinks authentication should still occur. Where
in my development environment, the cookie gets created and remains on
every page thereafter and everything works fine.

I have seen this questions in a few other posts, but none of them had
an answer. What could cause the authentication cookie to not get saved?
Can anyone please help!

Thanks in advance.
 
On 7 Sep 2005 07:37:23 -0700, (e-mail address removed) wrote:

¤ Hello All,
¤ I am going crazy trying to figure out why my ASP.NET web application
¤ cannot get beyond the login screen. It is using very simple Forms based
¤ authentication that works fine in my development environment:
¤
¤ if(!FormsAuthentication.Authen­ticate(tbUserName.Value,
¤ tbPassword.Value))
¤ {
¤ pageInfo.Text = "Invalid user name or password. Please try again.";
¤ }
¤ else
¤ {
¤ FormsAuthentication.RedirectFr­omLoginPage(tbUserName.Value,
¤ false);
¤ }
¤
¤ If the username and password are wrong, the Authentication fails as
¤ expected and the error message is displayed. If the credentials are
¤ correct, the Redirect does not happen and it returns to the login page.
¤ After turning Tracing on, I noticed that the authentication cookie is
¤ not getting saved. It gets created after the Login POST, but then the
¤ next page, the cookie is gone and the application redirects back to the
¤ login page because it thinks authentication should still occur. Where
¤ in my development environment, the cookie gets created and remains on
¤ every page thereafter and everything works fine.
¤
¤ I have seen this questions in a few other posts, but none of them had
¤ an answer. What could cause the authentication cookie to not get saved?
¤ Can anyone please help!
¤
¤ Thanks in advance.

Try re-posting your message to the ASP.NET group:

microsoft.public.dotnet.framework.aspnet


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Back
Top