IBM Computer, Laptops and Servers

Back Homepage Content Directory Resource Guide Blog

How do I refresh global.asa without restarting the application?

Plenty of people have asked how they can manually force global.asa to fire, without stopping and starting the web server or application. They already know they can't hit global.asa directly with a browser; this ends up in a 500-15 HTTP Error (Requests for global.asa not allowed). 
 
There is a way around this. This example will deal with forcing the application_onStart() routines to fire, without disrupting the server. 
 
The trick is to keep the logic in an #include file, and store that as an ASP page you can hit manually. Yes, many people aren't aware that you can #include a file in global.asa, but you certainly can. Here is some syntax within global.asa: 
 
<script language=vbscript runat=server> 
sub application_onStart() 
</script> 
    <!--#include virtual='/admin/start-app.asp'--> 
<script language=vbscript runat=server> 
end sub 
</script> 
 
The trick is that both global.asa and the #include file must have matching script types... no <%%> delimiters. The ASP page should also include straight script (no subs or functions) and not use any response-related methods. So your start-app.asp file should look like this: 
 
<script language=vbscript runat=server> 
' do stuff 
' insert into database 
' set application variables 
' etc etc. 
</script> 
 
Now this code will fire in the application_onStart() event, but you can also override it by hitting http://yourserver/admin/start-app.asp as well. 
 
This is very handy; however, I first employed this technique back during one of the first global.asa-related security exploits.

[ Comment, Edit or Article Submission ]

Share this:

Add To Yahoo MyWeb Add To Google Bookmarks Add To Furl Fav This With Technorati Add To Newsvine Add To Bloglines Add To Ask Add To Windows Live Add To Slashdot Stumble This Digg This Add To Del.icio.us Add To Reddit

More about:

Nov December 2008 Jan
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

IBM Computer, Laptops and Servers Blog on Technorati Related Blog of IBM Computer, Laptops and Servers on Sphere
Content Directory
Resource Guide


ClubMac Online Apple Macintosh Mac Catalog

Website Links
IBM Computer, Laptops and Servers Copyright © 2008 www.ibmfans.com. All rights reserved. Site Map
Homepage | Blog | Advertise | Privacy Policy | Disclaimer | Contact Us | Links