fire page once a day.

  • Thread starter Thread starter SStory
  • Start date Start date
S

SStory

I have an aspx page that is used to control automated tasks. It needs to be
visited every day at 1am.

The host provider provides no such service at present.

I was looking for ideas.

Thanks

Shane
 
Check out Autofire component. Just include it in your project and it will
work anywhere. U have to purchase it thou.
 
That is interesting but still don't see how it would work.

Wouldn't someone still have to visit the page and keep it open in their
browser for that to fire???

Thanks
 
No, not nescesarily. I don't know what the user is supposed to do in your
application, but if you want to keep the page warm for example to reduce on
on initial compile time you could put a timer on a form and within the timer
routine fire off a webrequest to call the page. Notice that I, the user,
have not physically navigated to the page, I just let the timer do the dirty
work for me - which is actually being performed on another thread by the
way. You can expand from this base however you see fit.

string url = "https://www.hotmail.com";
Uri ourUri = new Uri(url);

// Create a 'WebRequest' object with the specified url.
WebRequest myWebRequest = WebRequest.Create(url);

// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse();

// Use "ResponseUri" property to get the actual Uri from where the response
was attained.
if (ourUri.Equals(myWebResponse.ResponseUri))
Console.WriteLine("\nRequest Url : {0} was not redirected",url);
else
Console.WriteLine("\nRequest Url : {0} was redirected to
{1}",url,myWebResponse.ResponseUri);
// Release resources of response object.
myWebResponse.Close();


regards
 
bottom line is that I have a site that needs to perform some automated tasks
without user intervention.

I am not allowed to do SQL Server jobs, or scheduled tasks with the host
provider so I made a page to be called by the owner at 1am every day to
handle this.

She has had problems setting up scheduled tasks on her computer and was
wondering if there is any other way.

thanks
 
How about the following:
You could set up a timer object in your Global class within the Global.asax
code:
Dim myTimer as new System.Timers.Timer
set the interval and enable it in the Application_Start event:
myTimer.Interval = 20000
myTimer.Enabled = True
AddHandler myTimer.Elapsed, New System.Timers.ElapsedEventHandler(AddressOf
myTimer_Elapsed)

then create a myTimer_Elapsed method in this Global class to do
what you want when the time comes. You can check the
computer's time here and run a sub at the right time if the timer interval
is set to fire too frequently.
 
I think i replied to this. If you are willing buy the Autofire component
which will work beautifully.
 
hey that is an awesome idea.
Wonder if it will work on my host. Hopefully they don't have something
fixed where that is prohibited.

Thanks for the idea.

I am going to give it a try.

Shane
 
Back
Top