Wrox Programmer Forums
|
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 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 December 29th, 2005, 03:13 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Hit Counter

Hey there, sorry re the delay in getting back re this subject.

I did re install IIS and also made sure that the tags were on either end of the code. Still get the same thing. Have tried a few versions of this global.asa file in a few Wrox books and get the same thing.

Currently I have done the following. I hope the detail helps.

1st: Created a Global.asa file with the following code.
<script language="vbscript" runat="server">
Sub Session_OnStart
Session("StartTime") = Now()
Application.Lock
Application("TotalNumberOfUsers") = _
Application("TotalNumberOfUsers") + 1
Application("CurrentNumberOfUsers") = _
Application("CurrentNumberOfUsers") + 1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("CurrentNumberOfUsers") = _
Application("CurrentNumberOfUsers") - 1
Application.Unlock
End Sub
Sub Application_OnStart
Application("EMailAddress") = "[email protected]"
End Sub
Sub Application_OnEnd
End Sub
</SCRIPT>

This asa file is in the following directory.
http://localhost/timber/session/global.asa
The session folder is marked as an application in IIS.

Secondly I have entered the following into my search page. Have also listed the directory of this folder. The reason I have this in my search.asp page is that I want people that login to see how many are logged in.

<body>
There have been <B><%= Session("VisitorID")%></B> total visits to this site.<BR>
You are one of <B> <%= Application("Active")%></B> active visitors.<BR>
Your session started at <%= Session("Start") %>
</p>
</body>

http://localhost/timber/html/search.asp

Let me know if I can supply more details.

Mally.

 
Old December 29th, 2005, 03:20 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Also I tried this as it was in the Wrox ASP book I beleive.


<%=Application("CurrentNumberOfUsers")%>

 
Old December 29th, 2005, 03:26 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You shouldn't mark the Session folder as an application, but the entire Timber folder.

Right now, the Session and the Html folder are two different applications; a hit to Search.asp won't be registered in Session_Start in the Session folder.

Once you remove the App from the Session folder and then make timber an application, both Session and Html share the same application and session state and things will work....

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 29th, 2005, 04:04 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar, thanks for the reply.

So when we say the whole timber folder, we mean the whole site in my case.

http://localhost/timber/session/global.asa

Is that ok to do?



 
Old December 29th, 2005, 04:12 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmm, I did just try that. Deleted the app from the session folder and found that the timber was already marked as an app in IIS.

Still didnt work.

Anything I can post to help?

 
Old December 29th, 2005, 05:30 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Then you should check your code. Look at this:

There have been <B><%= Session("VisitorID")%></B> total visits to this site.<BR>
You are one of <B> <%= Application("Active")%></B> active visitors.<BR>
Your session started at <%= Session("Start") %>

Session("VisitorID") is NOT set in global.asa and the same applies for Application("Active")

Session("Start") is called Session("StartTime") in your global.asa file....

Try writing out Application("EMailAddress") as that should contain a valid value and see if that works.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 29th, 2005, 07:06 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey there, I think by trying all 3 examples in 3 Wrox books, I got them all mixed up.

I have made the neccesary changes. When viewing localy it works like it says in the book.

Tried by making the whole site an App, but it would not work. Ended up puting both the files, global.asa & hitcounter.asp in the html folder and made the html folder an App,. Worked just fine.

Now finding that when I upload the file, I dont get any result, just the default text. "Currently, user(s) are browsing our site, ETC.

Any thing else that you can think of?


Thanks Imar.

Mally.

http://localhost/timber/html/hitcounter.asp

Currently, <%=Application("CurrentNumberOfUsers")%> user(s) are browsing our site.
We’ve received <%=Application("TotalNumberOfUsers")%> visit(s) since the start of the application.

http://localhost/timber/html/global.asa

<script language="vbscript" runat="server">
Sub Session_OnStart
Session("StartTime") = Now()
Application.Lock
Application("TotalNumberOfUsers") = _
Application("TotalNumberOfUsers") + 1
Application("CurrentNumberOfUsers") = _
Application("CurrentNumberOfUsers") + 1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("CurrentNumberOfUsers") = _
Application("CurrentNumberOfUsers") - 1
End Sub
Sub Application_OnStart
Application("EMailAddress") = "optusnet.com.au"
End Sub
Sub Application_OnEnd
End Sub
</script>
 
Old December 29th, 2005, 07:24 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The global.asa file should be in the root of the application. By moving it to the Html folder and by marking the Html folder as an application, you accomplished that (since Html is an app, Html\global.asa is in the root of the app / site).

However, this is probably not the case on your live server. Most likely, the root of the site is the application there, and not /Html.

So, move the global.asa file to the root of your site, remove the App from /Html and make / an application again. Then it will probably work on your live server as well.

Something like this should work:

/ (Marked as an app in IIS)
/global.asa (in the root)
/Default.asp (falls under the root)
/Html/SomePage.asp (falls under the root as well, so shares session and app state with /Default.asp)

Does this help?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 29th, 2005, 08:30 AM
Authorized User
 
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, it does.

So far I have

Removed the App from the html folder.
Marked the site as an App, C:/Inetpub/wwwroot/timber
Moved the Global.asa file to C:/Inetpub/wwwroot/timber/global.asa
I have left the hitcounter.asp file under, C:/Inetpub/wwwroot/timber/html/hitcounter.asp.

Is this correct? What is the Default.asp folder you mentioned?



 
Old December 29th, 2005, 08:39 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, correct.

/Default.asp is not a folder, but a file. Under IIS you have a default document that is served when a user types in http://localhost/ for example instead of http://localhost/SomePage.asp

By default (no pun intended) the default document is default.asp. So, when you have that file in the root of your site, or in any other folder, that file is served when no explicit document is specified in the URL.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
A Hit Counter, PLEASE HELP !!!!! ARD_40 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 April 23rd, 2006 06:25 AM
Hit Counter Help! NeilS21 Classic ASP Databases 4 April 29th, 2005 06:59 AM
hit counter gumgak Classic ASP Basics 2 November 2nd, 2003 12:44 AM
Hit Counter mateenmohd HTML Code Clinic 7 September 28th, 2003 07:22 AM





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