[.net] ASP.NET automated tasks

Started by
7 comments, last by edotorpedo 17 years, 7 months ago
Hi again! I want to send emails to online users in a regular basis (daily, in a given time for every single user). How can i do that? (the server is not under my control, we are using a commercial one) Thank you in advance!
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
Advertisement
I would think this would depend on what the people that are running the servers you're using allow. You might want to contact them.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

i don't even know what the possibilities are... :S
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
if all you want to do is send masses of emails, the normal things is to use a "list server" ... which is often nothing more that a simple web app that manages list of email addresses and lets you send emails to the list as a whole. Thats one side of it. The other side is the "scheduled task" side of things, which you don't really do in "asp.net" ... because the whole idea of asp.net is that there is nothing sitting their running between requests. Of course you can spawn additional threads, launch apps, etc, and spin loops checking the time - but most server companies frown on rolling your own for this kinda thing, cause you are in a shared enviroment and it wastes processor usage. The norm here is that they will provide some sort of scheduling feature (in unix it is cron jobs - don't know how windows admins expose acess to the OS scheduler).
okay, i get it now, thanks!
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin
For similar uses I wrote a multithreaded class and created an instance of that class in global.asax in Application_Start. Works for me.

It can be done... The easiest way (the way I did facing the same problem) is to have a normal scheduled task in your windows and have it connect to some webpage. This webpage performs a task upon page_load.

start -> programs -> accessories -> system tools -> scheduled tasks

Example: schedule task "Internet Explorer -http://www.yourwebsite.com/sendemails.aspx", which send emails.

Of course this isn't the most secure way, as anyone can access this page. Therefore the best way is to write a small .exe which connects to a webservice with a username-password combo.

Of course you have to have access to a server which is online 24/7 and have rights to schedule a task. Normally this server is the same server your web-app resides.

Hope this helps,

Edo
Edo
Quote:Original post by Anonymous Poster
For similar uses I wrote a multithreaded class and created an instance of that class in global.asax in Application_Start. Works for me.


that will be it :)

edotorpedo: yes, this is an easy way, provided you have another machine running 24/7. The only machine i can rely on is the host server...
"Knowledge is no more expensive than ignorance, and at least as satisfying." -Barrin

We send our host server administrator a box of chocolates every 3 months :) Get's a lot of things done...
Edo

This topic is closed to new replies.

Advertisement