Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Notifying a user when the session timeouts
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00228729
Message ID:
00228992
Views:
9
Yikes! Sorry for the confusion. We store the connection STRING in the Session object, not the connection object itself. And yes, we do use MTS. We pass the connection string to the component.

>Can I ask you why you are storing the connection object in a session variable? You obviously are not using MTS. Are you using Components?
>
>>Quite true. We use the LEN() function because not only does it tell us if the user's session has timed out, it also serves to prevent users from entering the site in the middle since if they don't use the start page, the connection string doesn't get set.
>>
>>>FYI, you can also use isObject(Session) to see if the Session Object still exists. Thanks for the info. I was afraid of that.
>>>
>>>>>>>What is the best way to redirect a user to another page when their session timeouts?
>>>>>>
>>>>>>Why not use Response.Redirect if session variables are empty?
>>>>>
>>>>>Because I don't want to have to check session variables everytime a user clicks a button or link. I have been trying to use the Session_Onend event, but with no luck. It doesn't seem to do anything. Have you used this?
>>>>
>>>>Because ASP cannot respond to events, Session_OnEnd doesn't really help with this. Testing a Session variable is pretty much your only option. Since we store the ADO connection string to a Session variable, at the top of every page we test it's length using LEN(). If it evaluates to zero, we know the session has timed out and we redirect them to a page that tells them what happened. Our code looks like this:
>>>>
>>>><%
>>>>If Len(Session("strConn")) = 0 Then
>>>>Response.Redirect "timeout.asp"
>>>>End If
>>>>%>
>>>>
>>>>We keep the code in an include file and we've added the include reference into the default ASP page template so it's always there whenever we create a new ASP page.
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Previous
Reply
Map
View

Click here to load this message in the networking platform