Forum Moderators: coopster & phranque

Message Too Old, No Replies

Catch 22 Session_OnStart?

I'm sure I'm missing something but I can't put my finger on it.

         

9thsign

5:01 am on Feb 5, 2002 (gmt 0)

10+ Year Member



Ok, this is the dillema I'm having: I have a Crystal Reports-ASP web app that was originally designed by an outside consultant. Problem is that one of our programmers is currently running some tests on the db side - Access & Excel (don't ask me why he chose to use those apps, I'm wondering myself), and he must close out the browser then open it back up before he can see the changes go into effect.

Of course this is because he used session variables to store the fields and companies and so on - that's no sweat. So I then thought to myself I'll just set those to nothing when the index.asp page loads. Problem is that he set those variables in the global.asa with Session_OnStart.

Now I can do a couple of things to end the session (like Session.Abandon) but what I want to do is to make sure that ONLY on the index.asp page loads it starts the session again. I thought about using something like this:

If Request.ServerVariables("SCRIPT_NAME") = "index.asp" then

Session.Abandon

End If

but of course it works great if I stay on the index because it kills the session right after it starts it, but it fails when I go to another page then back to the index.asp ...... anyways, to sum it up, does anyone know a way to do this without having to change the structure of the pages?

thanks

circuitjump

3:22 pm on Feb 5, 2002 (gmt 0)

10+ Year Member



Unfortunatly from my expirience, thats how it works. Why don't you try this, instead of having this

If Request.ServerVariables("SCRIPT_NAME") = "index.asp" then

Session.Abandon

End If

Try this

If Request.ServerVariables("SCRIPT_NAME") = "index.asp" then

server.transfer("/session_end.asp")

End If

And session_end.asp will have the session destroy commands + another server.transfer("index.asp") but this one goes back to the main page and starts a new session. With server.transfer your client will never notice that the page has changed to session_end.asp and back to index.asp

That's most likely what I would do in this situation.

Hope this helps :)