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

global.asa

Status
Not open for further replies.

cjkenworthy

Programmer
Joined
Sep 13, 2002
Messages
237
Location
GB
I've made a global.asa file for my site to control session timeouts and maintain track of number of users logged in.

How do I get dreamweaver to work with the global.asa file?

Where do i put it? Will it work in the directory where the rest of the files are on my server .../inetpub/
Here is the file below. How would I print the 'visitors' application variable below in any file?

Thanks, Chris.

<script language=&quot;vbscript&quot; runat=&quot;server&quot;>

sub Application_OnStart
Application(&quot;visitors&quot;)=0
Session.Timeout = 420
end Sub

Sub Session_OnStart
Application.Lock
Application(&quot;visitors&quot;)=Application(&quot;visitors&quot;)+1
Application.UnLock
End Sub

Sub Session_OnEnd
Application.Lock
Application(&quot;visitors&quot;)=Application(&quot;visitors&quot;)-1
Application.UnLock
End Sub

</script>

code ok?
 
code looks good - except you may want to put session.timeout=420 down to just below
sub session_onstart.

to use it in a page you'd put this

<%= Application(&quot;visitors&quot;) %> in a table cell or something whatever your layout dictates.

You'd put it into a page - save it as global.asa you do not nead the head, body, html tags.

put it in the root.
Which looks like in your case to be the site/ directory.

&quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Thats brilliant, thanks.

My ASP doesn't seem to want to work with the global.asa in that there is nothing in the visitors variable.

Do I need to stop and restart my web server?

I've put global.asa in the server directory:

(server drive:)../inetpub/
along with every other ASP file for my site.

There are other sites in the directory.
 
Actually, I moved it to the directory and it works now. Only problem is that if I close the browser without logging out it keeps an inaccurate number of users logged in. Obviously until it times out.

Any way around this - i.e. if a client closes the browser, automatically decrement the visitor counter?

thanks

Chris.
 
well there is and there isnt

there are ways and methods to log a user in and out. But pretty much there isnt a way to detect if the browser is closed - it'll just time out.

Strange on the directory - unless I misunderstood.

Such as

Server Directory C:\inetpub\
c:\inetpub\C:\inetpub\c:\inetpub\c:\inetpub\
something like above are typical settings - and the global asa should work there. - that is if your webhost has the default settings for your domain to be inside the html directory.

&quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
anytime - and yes it does sound like IIS Settings for sure. &quot;Damn the torpedoes, full speed ahead!&quot;

-Adm. James Farragut

Stuart
 
Status
Not open for further replies.

Similar threads

  • Locked
  • Question Question
Replies
2
Views
69

Part and Inventory Search

Sponsor

Back
Top