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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to empty session variable when leaving site.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have an ASP page where a database is accessed to determine a record count in a particular table and using a javascript alert box to tell the user how many records there are.

Now, I'd like the user to be able to go to a different page on the site and not have this box pop up when they come back to this page. (I only want the popup on the first viewing of the page.) However, I do want the popup to run again if the user leaves my site and comes back.

Here's the code I'm currently using:

<%
if not Session(&quot;Alerted&quot;) or Session(&quot;Alerted&quot;) = &quot;&quot; then
dim m_connLawyer
dim m_objLawyer
dim dicLawyer
dim regPending

set m_connLawyer = server.CreateObject(&quot;ADODB.Connection&quot;)
set m_objLawyer = server.CreateObject(&quot;Register.Utility&quot;)
set dicLawyer = server.CreateObject(&quot;Scripting.Dictionary&quot;)

m_connLawyer.Open g_conn 'global connection string

regPending = &quot;false&quot;
Set dicLawyer = m_objLawyer.GetUnapprovedLawyer(m_connLawyer)
if dicLawyer.Count > 0 then
%>
<script language=&quot;javascript&quot;>
alert(&quot;There are <%=dicLawyer.Count%> new lawyer registrations pending approval&quot;);
</script>
<%
end if
Session(&quot;Alerted&quot;) = &quot;true&quot;
end if
%>

Now, I want Session(&quot;Alerted&quot;) to empty when the user leaves the site. I've tried setting it to = &quot;&quot; in global.asa but since the session timeout is 20 minutes, it doesn't work consistently. And I need the timeout to be 20 minutes for other variables. Any ideas on what I can do?
 
I forgot to mention what the object references are:

Register.Utility -- Utility dll
m_objLawyer.GetUnapprovedLawyer -- retrieves a recordset of unapproved registrations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top