Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2004, 07:02 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

Ok... It is not working, and this all the pages that I have so far:

Global.asa:
Code:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart
    ' Set our user count to 0 when we start the server
    Application("ActiveGuests") = 0
End Sub

Sub Session_OnStart
    ' Change Session Timeout to 20 minutes (if you need to)
    Session.Timeout = 20
    ' Increase the active visitors count when we start the session
    Application.Lock
        Application("ActiveGuests") = Application("ActiveGuests") + 1
    Application.UnLock
End Sub

Sub Session_OnEnd
    ' Decrease the active visitors count when the session ends.
    Application.Lock
        Application("ActiveGuests") = Application("ActiveGuests") - 1
    Application.UnLock
End Sub

</SCRIPT>
Display User Count & Deletes User Count:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="Javascript">
function onunload() 
{
    leavewebsite.submit();
}
</script>
</head>
 
<body onunload="onunload();">
<form name="leavewebsite" method="post" action="deletesession.asp">
  <input type="hidden" name="hiddenField">
</form>
Users Online:<%= Application("ActiveGuests") %><br>
Most Users Online:<%=Application("MostPeopleOnline")%>
</body>
</html>
The Delete Session Page:
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%>
<% Session.Abandon() %>


 
Old September 22nd, 2004, 07:15 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

If you post the specific error your problem will be solved allot quicker. I personaly am on a dial up today and dont have time to find errors. If possible, solve errors, yes. Find errors and complete my own work, no.

BTW: Based on what you have said in a previous post, you need to close the delete session page? If so change it to:

<%
Session.Abandon()
%>
<script>
window.close();
</script>

Wind is your friend
Matt
 
Old September 22nd, 2004, 07:25 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

My problem is is i want to delete the the application session when the user closes the browser window. Instead of waiting 20 minutes for it to expire.

 
Old September 22nd, 2004, 07:33 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

what error are you getting when you run the pages

Wind is your friend
Matt
 
Old September 22nd, 2004, 07:35 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

It not a error. It is not delete the session.

 
Old September 22nd, 2004, 07:50 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Interesting, how do you know this?

does line one of your page not give you an error? it does for me:

Active Server Pages, ASP 0203 (0x80004005)
The specified code page attribute is invalid.
/NavSysCom/test.asp, line 1

What does this line do:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%>



Wind is your friend
Matt
 
Old September 22nd, 2004, 08:19 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default



http://www.asp101.com/articles/john/...nd/default.asp

Wind is your friend
Matt
 
Old September 22nd, 2004, 10:59 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

There has to be another way, other then a popup window. Because popup blockers DO BLOCK IT... and then the session will wait till it is timed out. For example windows SP2 does block the popup.

 
Old September 22nd, 2004, 11:58 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

They are the only two ways I know of 'and use'. There are all sorts of pop up blockers out there, most of these have preferences, have you checked these?

What pop up blocker are you using?

;;;For example windows SP2 does block the popup

I asume you are talking about XP SP2, are you saying this blocks all event triggered new windows? If so, I am very suprized. I havnt instaled SP 2 - yet. May I suggest you post again indicating you want session object help instead of global.asa help.

Wind is your friend
Matt
 
Old September 27th, 2004, 10:13 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

gmoney060

In regard to our previous discussions on the SP2 pop up issue:
XP service pack 2 does not stop user triggered new window functions.

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
Are functions allowed in global.asa file mat41 Classic ASP Basics 1 January 10th, 2008 01:58 AM
how to include file in global.asa beetle_jaipur Classic ASP Basics 1 April 18th, 2006 03:46 AM
Debugging Global.asa file arimakidd Classic ASP Professional 1 August 23rd, 2005 03:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.