Groups | Blog | Home
all groups > dotnet general > june 2004 >

dotnet general : Can asp.net do this?


Aaron
6/27/2004 7:40:55 PM
I want to write a script that deletes the last 10 records from a database on
the 1st of every month. Is there a way to do this without a user actaully
opens the page? Like windows schedule, it just starts on itself.

Note: This has to be a web-based app

Thanks
Aaron

Ken Cox [Microsoft MVP]
6/27/2004 10:46:11 PM
Hi Aaron,

You might want to see if this control does what you need:

PortSight Task Scheduler is a .NET component for immediate or planned
execution of server-side tasks from ASP.NET. It allows you to process
long-running ASP.NET pages, run command line utilities or other server-side
tasks without page time outs and under a privileged account.

http://www.asp.net/ControlGallery/ControlDetail.aspx?Control=1821&tabindex=2

Ken


[quoted text, click to view]
Steve C. Orr [MVP, MCSD]
6/27/2004 10:48:47 PM
ASP.NET pages aren't designed to do that kind of thing.
Instead I'd suggest creating a Windows Service.
Here's more information on Windows Services:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvssamp/html/vbcs_CreatingaWindowsService.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net


[quoted text, click to view]

Jeremy
6/27/2004 11:58:04 PM
You don't tell us what the DB is... IF it is SQL Server, then you can create
a Job within SQL Server and schedule it in SQL Server Agent. It has a pretty
good scheduler built right in. The Job can execute a a simple DELETE SQL
Statement a stored procedure containing more complex logic.

-J

[quoted text, click to view]

DM McGowan II
6/28/2004 7:48:14 AM
[quoted text, click to view]

Also mine, www.DiscountASP.net does this. It's very helpful and a free
service.
Sebastian
6/28/2004 11:08:09 AM
You could create bat file ex. "iexplore http://something/" and add it to
task scheduler.

--
Sebastian W.
[quoted text, click to view]

Annick Van Hoof
6/28/2004 12:57:45 PM
[quoted text, click to view]

If you're needing this scheduling on your "shared hosting" server you do
depend on your provider to allow this.
There are some "patch solutions" as discussed in the past, such as: using an
item in the ASP.NET cache for a specific time. after that time an event will
be triggered. You can then check whether it's the first day of the month, or
you could using a timer in the global.aspx file etc... With all know
problems: if the server is rebooted etc...

Of course you could implement this functionality in an ASPX page and have
your local PC (in case of a remote shared hosting package) "visit" this page
on the first of each month.

My ASP.NET hosting provider (www.alentus.com) did setup some kind of cron
job for me (with no extra cost). It's a process that "visits" my page every
30 minutes. In this page you could check whether it's the first of the
month.

Wim

Sean Bright
6/28/2004 5:27:48 PM
Aaron:

You have a strange set of requirements. It _has_ to be a web-based
application, but at the same time, you want it to run on a scheduled
basis _without_ user interaction.

As many others have said, a web-based approach is sub-optimal, and you
shouldn't waste the ASP.NET engine's time with something like this.

Windows Service, SQL Server 2000 Job, any number of command line tools
to kick it off; all more suited for this type of application.

Good luck,
Sean

[quoted text, click to view]
AddThis Social Bookmark Button