[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

RedirectFromLoginPage Erasing Session Values

Chris Moore

8/7/2002 11:12:00 PM

Here's the scenario, using MMIT and Visual Studio.NET:

login.aspx takes a user name and password, then queries a database to
authenticate the user. If the user/password combo is correct, the User ID,
User Name, and the User's Role are stored in session variables.

Session("User_ID") = dr.Item("User_ID")
Session("Name") = dr.Item("Name")
Session("Role") = dr.Item("Role")

Next I call RedirectFromLoginPage as follows:

MobileFormsAuthentication.RedirectFromLoginPage(txtUserID.Text, False)

This takes us to Default.aspx. In Default.aspx I pull up data based on the
User ID and the Role.
In Default.aspx, when a Signout button is clicked I delete all session data
as follows and return to Login.aspx:

Session.Clear()
Session.RemoveAll()
Session.Abandon()
System.Web.Mobile.MobileFormsAuthentication.SignOut()
Me.RedirectToMobilePage("Login.aspx")
The issue arises when I try to log back in a second time. The Session
values are set correctly for the new user, but the moment the
RedirectFromLoginPage command is executed all Session variables are blanked.
This of course messes up my Default.aspx queries.

Does anyone have any ideas why this is happening and how I can deal with it?

If I can't get by the above issue, what are alternate recommended approaches
for maintaining a user ID and a user's role?

Any assistance would be appreciated,
Chris