Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

losing session variable conundrum?

Status
Not open for further replies.

whatsthehampton

Programmer
Sep 13, 2005
121
CA
Hi all,

On the development machine - xp pro sp2 iis 5.1 - all works as expected.

On the live site - server 2003 - I am losing a session variable on an event click [or a double refresh??] - I have found that it only occurs when I include my global.asax file which has the folllowing routine in it.

Code:
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
       
        Dim sRequestedURL As String = HttpContext.Current.Request.Url.AbsolutePath
        
        'Note: This routine only handles non found pages
        If (sRequestedURL.Contains("404.aspx")) Then
            
            Dim sRaw As String = Request.RawUrl
            Dim strFile As String = Right(sRaw, sRaw.Length - InStrRev(sRaw, "/"))
            
            Context.RewritePath("~/links.aspx?" & strFile & "", False)
            
        Else
            'do nothing /continue...
        End If
       
    End Sub

My Global.asax in my project is an ordinary file with no codebind but when I build the solution this file is compiled into the dll as well as an App_global.asax.compiled file which I also include in the live site Bin - could this be the problem?

As I say everything works OK on the dev machine.

All help most appreciated

Cheers,
Jon





ToDo....
 
not familiar with Context.ReWritePath, but that shouldn't be flushing session.
session would be cleared if
1. the user logs out
2. session.Clear() is called
3. the application pool is refreshed
4. the web.config file is changed (which causes an app reboot)
5. some other hardware reasons that cause IIS or the application to reset.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks Jason,

I've fixed it now. I had set iis to redirect to the 404.aspx but it was redirecting multiple times as well as a problem in the links page - Doh!

Cheers,

Jon

ToDo....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top