views:

1179

answers:

8

I want to develop an Online Reminder service in ASP.NET 2.0 (C#) and SQL2005. But I am not getting the concept of reminder service. What I know is using an online reminder service I can schedule a reminder for future dates, which is sent to me (who schedule reminder) via email or SMS on that date. But in asp.net how to do this, caz anyone can schedule a reminder for any date, how we'll know that when to send that mail to the person. We have to put some loop or what.

So please guide me, what is the concept of an online reminder service and how I can easily develop this application using ASP.NET and SQL

Edited

I am on Shared hosting server, so that solution must be able to work on shared hosting.

Or

Please tell me if anyone knows about any FREE and open-source reminder service CMS which I can download and study it.

+2  A: 

Microsoft SQL Server 2005 have scheduling (sql jobs) and email features. You may even donot need to use ASP.NET.

NinethSense
+4  A: 

Ideally, you would have a windows service that would periodically (every few minutes) check if any new reminders need to be sent out. Since you are on shared hosting, you probably can't install a service though.

I'm not very familiar with windows shared hosting, but if you have the option of creating scheduled/cron job type tasks you could probably do it that way.

If you can't create a scheduled task on your server, another option would be to create a scheduled task on your home PC with a program/script that runs every few minutes and simply hits a special web page on your site. That page could then have the code that checks for reminders and sends them out. It's a bit of a hack, but it should work.

Eric Petroelje
A: 

First you will obviously need to create a user interface and database to store the reminders. That part you got. The next step is to create a service which periodically queries the database for reminders that are due for notification.

The best way to do this is to write a lightweight Windows Service which, as you suggest, uses a loop and a reasonable sleep time (so as not to monopolize the CPU) to continually check the database for reminders and dispatches notifications. It then processes each reminder based on your requirements.

But since you are on shared hosting, you can't deploy a Windows Service, so the next best thing is to run a background thread on Application_Start of your global.asax. There are many examples of how to do this, e.g.:

chaiwalla
A: 

Shared hosting will not work well with what you are trying to do. You could create a background polling thread on Application start, but it will get shut down at some point and may actually be prohibited by your hosting company. An infinite loop will most likely be detected by your hoster and result in your account being automatically shut down, especially if it is using a fair bit of CPU. As John suggests, there may be a scheduled tasks or hosted cron option with your ISP, but generally, those are just for doing things like nightly backups, not really having the level of granularity you need.

Simple answer is, you most likely need something other than a hosted account. You may need to look into a VPS shared hosting service or you may wish to consider looking into MS Azure or Amazon EC2. To do this right, you need to create an application, or better, a service that runs constantly, something a shared hosting account will not provide.

Serapth
A: 

There also a few services out there who can call a specific web page on your service periodically. You could use that to make the page check if there are any reminders that need to be sent.

However since you're then relying on an external site you can't control this might not be the ideal solution if it is very important that the reminders are always being sent.

janzi
A: 

1) Create a database for storing messages, with a datestamp

2) Create an SQL job, that selects all messages in a time period

3) From the SQL job, you can initialize an .net based SQL Function, that would send out the emails with the System.Net.Mail namespace.

balint
A: 

You might consider a 'hack' using the Cache expiration in for triggering events. Create new cache keys that expire at specific Date-Times to run the reminder or make it recur at defined intervals, checking a queue to see if anything new should be sent.

See: Easy Background Tasks in ASPNET

Nagyman
+1  A: 

Have a look at Quartz.Net (http://quartznet.sourceforge.net/). You can create an instance of the quartz scheduler in your Application_Start event and as long as the ASP.Net application is running, it will poll the database and trigger any functions you have registered with it. Since you are on a shared host environment, this is probably your best bet unless your hosting provider has a scheduler that can trigger a WebForm (or ASP.Net MVC Controller) periodically.

Amir Khawaja