Re: session variables disappeared when recompiling

From: sampsons (samp.sons@airmail.net)
Date: 03/27/03


From: "sampsons" <samp.sons@airmail.net>
Date: Thu, 27 Mar 2003 15:44:06 -0600


What I have done, is to make some functions that repopulate the session with
the least common denominator (i.e. the objects in session required to remain
logged in)

Then,

If User.Identity.IsAuthenticated Then
    If Session.Item("dsUser") is Nothing Then
        Response.Redirect("SessionFix.aspx")
    End If
End If

Then the SessionFix.aspx page contains

Dim username as String
Dim ds as New DataSet()
dim returnUrl as String = Request.URLReferrer
If User.Identity.IsAuthenticated Then
    username = User.Identity.Name
    ds = PubFunctions.GetUserInfo(username)
     Session.Add("dsUser", ds)
     Response.Redirect(returnUrl)
Else
    Response.Redirect("Login.aspx")
End If

Of course, PubFunctions.GetUserInfo(username) is a Function I wrote that
returns a DataSet, username as primary key.

Then, if a user loses the session, they are redirected to "SessionFix.aspx"
then redirected back to original page.
True, some items that are in session and are working may be lost, possibly
the last changed item (The session is lost and regained
when they clik on "Save Changes", the changes were not saved) The user will
only know that the "Save Changes"
button didn't work that time.

Severin.

"YA" <ra294@hotmail.com> wrote in message
news:uRKxgbK9CHA.1868@TK2MSFTNGP12.phx.gbl...
> I have noticed that when I recompile my asp.net application, all the
session
> variables disappeared.
> Is there a way to avoid it ?
> I am using form based authentication, is there a way to redirect
> automatically to login page in this situation ?
>
> Thanks
> ra294@hotmail.com
>
>
>
>