Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Asp Question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Asp Question

 Post Reply Post Reply Page  12>
Author
Tegwin View Drop Down
Senior Member
Senior Member


Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tegwin Quote  Post ReplyReply Direct Link To This Post Topic: Asp Question
    Posted: 02 November 2003 at 4:01pm
Ok, I am very new to asp and still trying to learn so forgive me if the question sounds dumb or trivial..

I have been following in a book, on how to make a simple web counter, they suggested to use a global.asa file. which has the following information in it

<Script.Language="vbscript" runat="server">

sub Application_OnStart
Application("count")=1
end sub

Sub Application_OnEnd
end sub

sub Session_OnStart
Application.lock

Application("count")=Application("count") + 1

Application.unlock
end sub

sub Session_onEnd
end Sub

</script>




then I have created a file called visitors.asp with the following code.



<%
   Response.Write("Number of people visited so far")
   Response.Write(application("count"))
%>



I have both these files copied into the same path, but when I run the visitors.asp  it only displays " Number of people visited so far" , but not the number..

What am I doing wrong ?




If you dont want my peaches, dont shake my tree
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 02 November 2003 at 7:05pm
the global.asa MUST be in the root of your site (or virtual dir) and if you have a host he must also support global.asa's
Back to Top
Tegwin View Drop Down
Senior Member
Senior Member


Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tegwin Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2003 at 1:17am
Michael, I am doing this on my own server.

The global.asa is in the  the virtutal directory. Basically I have a Virtual Dir called count, which is pointing to d:\webs\count and that is where the global.asa resides and also the visitors.asp and it does not work.



If you dont want my peaches, dont shake my tree
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2003 at 2:50am

<Script.Language="vbscript" runat="server"> try removing the '.' between script and language.

Mart.

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2003 at 2:53am

But it looks as if your using golbal.asa for a page counter. You cant do that because application reset when the server restarts etc. But you can do a 'active visitor' counter like on the bottom right of this page.

Mart.

Back to Top
Tegwin View Drop Down
Senior Member
Senior Member


Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tegwin Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2003 at 10:43am
Mart, thanks for that, Yes it is for a page counter, I have found this very script in a book on learning ASP, so one would hope the authors know that a global.asa cant be used for this purpose... oh well perhaps not.

Do you know where I can get an example of an "active visitor" script as on this page.

If you dont want my peaches, dont shake my tree
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2003 at 11:20am

http://asptutorial.info/learn/global_asa.asp at the bottom of the page.

Mart.

Back to Top
Tegwin View Drop Down
Senior Member
Senior Member


Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tegwin Quote  Post ReplyReply Direct Link To This Post Posted: 03 November 2003 at 12:23pm
Ok i think something must be wrong here now. I have copied and pasted the code, exactly like in the example above at your link http://asptutorial.info/learn/global_asa.asp

global asa


<SCRIPT LANGUAGE="VBScript" RUNAT="Server">

Sub Application_OnStart
application("activevisitors")=0
End Sub

Sub Application_OnEnd
End Sub

Sub Session_OnStart
application.lock
application("activevisitors")=application("activevisitors" )+1
application.unlock
End Sub

Sub Session_OnEnd
application.lock
application("activevisitors")=application("activevisitors" )-1
application.unlock
End Sub

</SCRIPT>



and visitors.asp



<HTML>
<BODY>

There are  <% =application("activevisitors") %> active visitors.

</BODY>
</HTML>



I have copied both files into c:\inetpub\wwwroot\count  and there is a virtual directory called count which is pointing to c:\inetpub\wwwroot\count

so to access this I am entering http:\\localhost\count\vistors.asp

The result is :-  There are active visitors.  (As you can see there is no figure)  I have tried to refresh a few times and still the same..

HELP!!!





Edited by Tegwin
If you dont want my peaches, dont shake my tree
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.