Solved

ASP Trigger for time based event

Posted on 2013-01-14
4
389 Views
Last Modified: 2013-01-16
Hi,

Running classic ASP with Sql Server (sql version), I need to find a solution for triggering a time-based event in this stateless environment.  Surely there must be some way to do this.  Eg I need a way to trigger a function in classic ASP code that imports data from an external txt file into SQL server table.  This even needs to run at five in the morning every day.
 
If not classic ASP, then how is it done in .NET?  We could turn on .NET for that purpose alone.

Thanks for any help...
0
Comment
Question by:crystaltec
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 38777023
You simply need to run a scheduled task.  Do you have access to the task scheduler or are you on a shared host?  Some shared  hosts will have a way for you to schedule a task.  You can have the task scheduler hit your asp page or just make it a vb or vbs.
0
 

Author Comment

by:crystaltec
ID: 38777062
I have full access to the host. So the scheduled task would literally open a page on my site?
0
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 38777072
I have task scheduler hit a vbs file that does an xmlhttppost to my asp page.  The vbs file can be outside of your website.  I will  post some data so the page knows it was the server hitting it and not something else.  




Call RunFile() 
 Sub RunFile() 

     'Force the script to finish on an error. 
     On Error Resume Next 

     Declare variables 
     Dim objRequest 
     Dim URL 

     Set objRequest = CreateObject("Microsoft.XMLHTTP") 

	 theData="x=123&y=abc&z=ee" 
     URL = "http://www.mydomain.com/file.asp" 

     objRequest.open "POST", URL , false  
	 objRequest.setRequestHeader "lastCached", now() 
	 objRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
     objRequest.Send theData
     Set objRequest = Nothing 

 End Sub 

Open in new window


Does  your name come from the old hosting company?  If so their control center panel has a task scheduler that can hit a page directly.
0
 

Author Comment

by:crystaltec
ID: 38785051
Seems to work perfectly.

Thanks!
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Set time on Session (ASP) 14 31
Time comparison asp 1 22
Securing WEBAPI on Azure 2 28
Boolean 13 28
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question