Authentication Twice?

  • Thread starter Thread starter ClevelandSteve
  • Start date Start date
C

ClevelandSteve

I am using forms authentication in my project. Within my login page I
check that the user is valid against the database and use the following
code to issue the cookie and redirect them to the next page:

FormsAuthentication.SetAuthCookie(txtUser.Text.Trim, False)
Response.Redirect("UserAccount.aspx")

My problem is that rather then loading the UserAccount.aspx page, it is
redirecting back to the login page. When a valid user and password is
entered a second time, the useraccount.aspx page loads. Any idea why
this is happening?
 
I figured out what was happening. I was running my page through Visual
Studio, so the URL in Internet Explorer would contain "localhost"
and the cookie was issued for localhost. On the redirect I was using
the IP address of the page and since the cookie was issued under
localhost, the form validation would kick in again. It works fine when
I open Internet Explorer and type in the URL directly.

Thanks for taking a look though.
 
Back
Top