Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - How to trigger global.asa automatically
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to trigger global.asa automatically

 Post Reply Post Reply
Author
mattsang View Drop Down
Newbie
Newbie
Avatar

Joined: 24 October 2002
Location: Hong Kong
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote mattsang Quote  Post ReplyReply Direct Link To This Post Topic: How to trigger global.asa automatically
    Posted: 22 January 2004 at 11:29pm

Dear Folks,

I would like to write a global asa file (as below) and hope it would initiate itself (without visiting the site) automatically to perform a routine data retrieval from the DB and write it in a mail for making a routine data report via e-mail. As I finished the programming, I tested it and found that it only initiated once and send the e-mail as I wish to my a/c but it did not perform the task routinely..would any expertise here help and modify my coding? Many Many thanks

My main cocern is 1) the script can starts itself in IIS (I have checked the setting in IIS and make it right 2) the script can peform the task routinely

 

My coding

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

Sub Application_OnStart()

Do While not isNull(application("te_todaysDate"))

' CONFIGURATION OPTIONS
' Description: Set the frequency by setting the execution_feq equal to D or H
'
 execution_feq = "H"    ' D = Execute Code Once Daily
             ' H = Execute Code Once Hourly

on error resume next


if UCase(execution_feq) = "H" then

' GET THE TIME IN LONG FORMAT, GRAB THE HOUR
 my_time = FormatDateTime(now(),vblongtime)
 my_time2 = instr(CStr(my_time),":")
 my_time = Left(my_time,my_time2-1)

' IF THE APPLCIATION VARIABLE IS EMPTY INITIALIZE IT AND EXECUTED THE CODE

 if isNull(application("te_todaysDate")) then
  ' execute function/code

  **my e-mail script**
  
  application.lock
  application("te_todaysDate")=my_time
  application.unlock
 end if

' IF THE APPLCIATION VARIABLE IS NOT EQUAL TO TODAYS DATE EXECUTE CODE

 if application("te_todaysDate") <> my_time then
  ' execute function/code

  **my e-mail script**
  
  application.lock
  application("te_todaysDate")=my_time
  application.unlock
 end if

end if

Loop

End Sub

</SCRIPT>

Back to Top
MadDog View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 01 January 2002
Status: Offline
Points: 3008
Post Options Post Options   Thanks (0) Thanks(0)   Quote MadDog Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 2:39am
Everytime someone goes to your site the global.asa file is automaticly ran.
Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 2:46am
Usualy this is achieved by running a vb script on the server. But you should check with your host if he allows this. Some don't.
Cristian Banu
Soft 4 web
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 4:56am
You can only have one global.asa file per site and this must go in the root directory of your site.

Each time a user comes to your site the global.asa file is automactically run by the web server.

You do need to check with your host though as not all allow global.asa files and may disable it. Global.asa files won't work on free hosting accounts becuase of the way they are setup.


Edited by -boRg-
Back to Top
mattsang View Drop Down
Newbie
Newbie
Avatar

Joined: 24 October 2002
Location: Hong Kong
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote mattsang Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 9:13am

Is it possible to make it starts itself (without depending on the visitor surfing) or just initiate the file once, and then to schedule it to run routinely?

I can manage the IIS environment,so the I am not worry about the setting

Anyone have new idea about the coding to achieve my expected results? 

 

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

Joined: 07 August 2003
Location: United Kingdom
Status: Offline
Points: 218
Post Options Post Options   Thanks (0) Thanks(0)   Quote God_Struth Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 10:24am
If your using a windows machine use task scheduler.
"I'm only trying to help......"
Back to Top
mattsang View Drop Down
Newbie
Newbie
Avatar

Joined: 24 October 2002
Location: Hong Kong
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote mattsang Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 10:52am

Originally posted by God_Struth God_Struth wrote:

If your using a windows machine use task scheduler.

I see...you mean the "scheduled tasks" under "system tool" of "Accessories", right?

if so...I really need not write the scripting and save it as global.asa..and just save it as a ordinary ASP and schedule it, right?

 

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 23 January 2004 at 7:49pm

Originally posted by MadDog MadDog wrote:

Everytime someone goes to your site the global.asa file is automaticly ran.

Only when they hit their first asp page. .html pages don't trigger it.


Lead me not into temptation... I know the short cut, follow me.
Back to Top
 Post Reply Post Reply

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.