468,252 Members | 1,486 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,252 developers. It's quick & easy.

Auto Run ASP.NET pages



I want to auto run asp.net page after a fixed interval of time without
sending any request from browser to server. I dont want to use windows
service or something like that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #1
5 2729
Khurram Hanif <kh********@yahoo.com> wrote in news:eKQqbM13EHA.3224
@TK2MSFTNGP10.phx.gbl:
I want to auto run asp.net page after a fixed interval of time without
sending any request from browser to server. I dont want to use windows
service or something like that.


AFAIK there isn't an easy way to launch a page or keep a site alive...

However, Paul Wilson does have an artice on how to extend the globalbase
class to reload the page automatically to keep an ASP.NET application
alive. You might be able to modify it for your purpose:

http://authors.aspalliance.com/PaulW...rticles/?id=12

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 19 '05 #2
Ha! I think I just answered you under another name on the
asp.net forums, but here's a copy in case you're someone else:

Not that *I* know of. Web (including asp.net) pages are
"dumb" and only respond to requests.

The first dirty solution that comes to mind is setting up a
small console app to run as a scheduled job...in it you
could use a HttpWebRequest object to invisibly fire a
request to the page so it would run.

However, that might be a cosmic waste of time when you
could have just placed the code you needed to run within
the console application, that's probably your best bet and
easiest solution.

I have no idea what your requirements are so I'm just
shooting in the dark here.

-v
-----Original Message-----
I want to auto run asp.net page after a fixed interval of time withoutsending any request from browser to server. I dont want to use windowsservice or something like that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
.

Nov 19 '05 #3
Try using System.Timer inside of Application.Start in global.asax. It can
trigger a new thread in defined intervals. Maybe enough for you, but aware
that this would be running under aspnet working thread and corresponding
privildges.
"Khurram Hanif" <kh********@yahoo.com> píse v diskusním príspevku
news:eK**************@TK2MSFTNGP10.phx.gbl...


I want to auto run asp.net page after a fixed interval of time without
sending any request from browser to server. I dont want to use windows
service or something like that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 19 '05 #4
I've made a test using the Timer Component and it work *almost* fine.

The code on the Enabled event is like this:
System.IO.TextWriter writer = new
System.IO.StreamWriter("d:/tmp/global_timer.log", true);
writer.WriteLine(String.Format("Log time: {0:F}", DateTime.Now));
writer.Flush();
writer.Close();

However the log is being appended twice.
Here's a chunk of the log:

App Started at Friday, January 21, 2005 12:55:56 AM
Log time: Friday, January 21, 2005 12:56:56 AM
Log time: Friday, January 21, 2005 12:56:56 AM
Log time: Friday, January 21, 2005 12:57:56 AM
Log time: Friday, January 21, 2005 12:57:56 AM
Log time: Friday, January 21, 2005 12:58:56 AM
Log time: Friday, January 21, 2005 12:58:56 AM
Log time: Friday, January 21, 2005 12:59:56 AM
Log time: Friday, January 21, 2005 12:59:56 AM
The first line is logged on the Application.Start method, with similar code.

Regards,
Manuel.

"Jiri Zidek" wrote:
Try using System.Timer inside of Application.Start in global.asax. It can
trigger a new thread in defined intervals. Maybe enough for you, but aware
that this would be running under aspnet working thread and corresponding
privildges.
"Khurram Hanif" <kh********@yahoo.com> pÃ*se v diskusnÃ*m prÃ*spevku
news:eK**************@TK2MSFTNGP10.phx.gbl...


I want to auto run asp.net page after a fixed interval of time without
sending any request from browser to server. I dont want to use windows
service or something like that.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 19 '05 #5
BTW, I modified a little bit the Elapsed code to write two lines instead, it
seams the Elapsed event is fire twice, take a look to the log:

App Started at Friday, January 21, 2005 1:18:20 AM
Log time: Friday, January 21, 2005 1:19:19 AM
EOL
Log time: Friday, January 21, 2005 1:19:20 AM
EOL
Log time: Friday, January 21, 2005 1:20:19 AM
EOL
Log time: Friday, January 21, 2005 1:20:20 AM
EOL
Log time: Friday, January 21, 2005 1:21:19 AM
EOL
Log time: Friday, January 21, 2005 1:21:20 AM
EOL
Notice the 1 sec diff! The interval, you might have guessed, is 60 secs.

Is this a bug or something?

Regards,
Manuel.
"Manuel Vázquez" <Manuel Vázq***@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
I've made a test using the Timer Component and it work *almost* fine.

The code on the Enabled event is like this:
System.IO.TextWriter writer = new
System.IO.StreamWriter("d:/tmp/global_timer.log", true);
writer.WriteLine(String.Format("Log time: {0:F}", DateTime.Now));
writer.Flush();
writer.Close();

However the log is being appended twice.
Here's a chunk of the log:

App Started at Friday, January 21, 2005 12:55:56 AM
Log time: Friday, January 21, 2005 12:56:56 AM
Log time: Friday, January 21, 2005 12:56:56 AM
Log time: Friday, January 21, 2005 12:57:56 AM
Log time: Friday, January 21, 2005 12:57:56 AM
Log time: Friday, January 21, 2005 12:58:56 AM
Log time: Friday, January 21, 2005 12:58:56 AM
Log time: Friday, January 21, 2005 12:59:56 AM
Log time: Friday, January 21, 2005 12:59:56 AM
The first line is logged on the Application.Start method, with similar
code.

Regards,
Manuel.

"Jiri Zidek" wrote:
Try using System.Timer inside of Application.Start in global.asax. It
can
trigger a new thread in defined intervals. Maybe enough for you, but
aware
that this would be running under aspnet working thread and corresponding
privildges.
"Khurram Hanif" <kh********@yahoo.com> píse v diskusním príspevku
news:eK**************@TK2MSFTNGP10.phx.gbl...
>
>
> I want to auto run asp.net page after a fixed interval of time without
> sending any request from browser to server. I dont want to use windows
> service or something like that.
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Rick Csucsai | last post: by
3 posts views Thread by John A Grandy | last post: by
1 post views Thread by daniellee2006 | last post: by
5 posts views Thread by lazypig06 | last post: by
27 posts views Thread by Harris Kosmidhs | last post: by
3 posts views Thread by Iluvatar | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.