Maintaining session and auth. ticket from page to page redirection


Thomas Fujita


I'm hoping that someone can clear some of my confusion as I cannot seem to
find a complete answer on the subject.

I'm using VS.NET 2003 and creating an ASP.NET mobile application.
I'm using Forms Authentication to authenticate the user.
Now, I'm assuming that the device that hits this ASP.NET application cannot
support cookies. Therefore, I've setup my web.config as such (i.e. setting
sessionstate cookieless=true etc).
Now, on all of the examples that I have seen on this subject, they always
use the MobileFormsAuthentication.RedirectFromLoginPage method to go to the
next page. However, I'd like to control where the user goes next and
therefore would like to use Me.RedirectToMobilePage. However, I've read that
only the RedirectFromLoginPage supports putting the authentication ticket
and session in the query string where as I have not read anything about
RedirectToMobilePage supporting this functionality. I have a strange feeling
that it doesn't because when I use RedirectToMobilePage after validating the
login, the application appears to try and go to my next page (another aspx
page), but cannot find an authentication ticket in the query string and
sends me back to the login page.

So, how does one go from page to page and maintain all that authetication
data in the query string?
Here is what I have in my Login code-behind:

'Verify that it is a valid user.
If (CheckCredentials(tbLogin.Text.Trim, tbPassword.Text.Trim)) Then
Session("UserID") = tbLogin.Text
FormsAuthentication.SetAuthCookie(tbLogin.Text, False)
' Create a client script to open the window
sUrl = "../Loads/Loads.aspx"
nFailedLogin += 1
Session("FailedLoginAttempts") = nFailedLogin
sUrl = "../Login/BadLogin.wml"
End If
'MobileFormsAuthentication.RedirectFromLoginPage(tbLogin.Text, True)

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

Members online

Forum statistics

Latest member

Latest Threads