Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Auto Run ASP.NET pages

3 views
Skip to first unread message

Khurram Hanif

unread,
Dec 11, 2004, 2:29:09 AM12/11/04
to

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!

Lucas Tam

unread,
Dec 11, 2004, 3:17:11 AM12/11/04
to
Khurram Hanif <khurr...@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/PaulWilson/Articles/?id=12

--
Lucas Tam (REMOV...@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

V. Jenks

unread,
Dec 11, 2004, 4:56:49 AM12/11/04
to
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

>.
>

Jiri Zidek

unread,
Dec 11, 2004, 4:15:36 PM12/11/04
to
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" <khurr...@yahoo.com> píse v diskusním príspevku
news:eKQqbM13...@TK2MSFTNGP10.phx.gbl...

Vázquez@discussions.microsoft.com Manuel Vázquez

unread,
Jan 21, 2005, 12:07:03 AM1/21/05
to
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.

Manuel Vázquez Acosta

unread,
Jan 21, 2005, 1:29:48 AM1/21/05
to
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:7427F2D4-6697-40A1...@microsoft.com...

0 new messages