fire page once a day.

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
 
R

Rajesh.V

Check out Autofire component. Just include it in your project and it will
work anywhere. U have to purchase it thou.
 
A

Alvin Bruney

you have a couple of choices here. put a timer on the form and set it to
fire every 12 hours from 1am. I'd stop there because this is really the
better option. You can also use a thread with a sleep time, which is
essentially the same thing. you can use a server but i doubt your provider
will let you run a service on the server
 
S

SStory

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
 
A

Alvin Bruney

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
 
S

SStory

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
 
E

eh

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.
 
R

Rajesh.V

I think i replied to this. If you are willing buy the Autofire component
which will work beautifully.
 
S

SStory

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top