Authentication Twice?

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?
 
C

ClevelandSteve

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top