I use forms authentication to login and then redirect users to another site. When they return the first time they are directed to the login page. After this it works fine but they shouldn't have to login twice!
Is the other site part of the same application? I'm missing something
1. User logs in.
2. User is redirected to another site (seperate from login)
3. User returns to site and is required to login again
4. User isn't redirected to another site again?
Not sure what you meant by "After that it works fine". If you're totally redirecting to another page, and the session dies...and you aren't writing a cookie to the client and checking it upon return to the login screen, then it makes sense that they're supposed to re-login.
Let me know if I'm missing something and what you'd rather have it do.
I am assuming that your users are shown another login page right after they log on. Hence, they have to login twice?
If that's the case, I had a similar problem earlier. It turns out that, for my case, the problem comes from using Server.Transfer() with storing Session state. So my initial code looks something like this:
This caused the page to be displayed twice to the users somehow. The second one does nothing because the user validation has been done the first time.
The problem apparently comes from the volatility of the Session state data. When I did Server.Transfer(), I was essentially interrupting the Session state processing somehow. So the solution for my case is to either use FormsAuthentication.RedirectFromLoginPage(), or Response.Redirect() with the second parameter set to false. FormsAuthentication.RedirectFromLoginPage() requires you to use "default.aspx" (I can't figure out how to use it with other page name), or if you decide to use another name for your page, use Response.Redirect().
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.