title: Time Based Events in ASP.net
body: <p>I need to perform some events (sending emails, etc.) based on time.  What is the best way to accomplish this in ASP.net in a hosted (medium trust) environment?</p>
  
  <p>ex:  Send email every day at 4:00pm.<br>
  ex:  Send email after 15min of login.<br>
  ex:  Send email after 10 hrs of last change to status.</p>
  
  <p>The triggering logic can be complex on some of the requirements, so I need to build a flexible system to handle these sorts of events.  I am stuck on the core activation method for this code.  </p>
  
  <p>Here are the options I have so far...</p>
  
  <p><strong>1) Timer in Global.asax</strong><br>
     + Simple<br>
     - Is not reliable, the web application can unload in IIS and the event will not fire.<br>
     ? Possibly use external pinger service to keep app alive (reliable?)</p>
  
  <p><strong>2) Windows Service to perform action</strong><br>
     - Slip/Maintain separate code.<br>
     - Can not install in hosted environment (shared/cloud hosting)  </p>
  
  <p><strong>3) Windows Service to call Web App (calls webservice or runs page)</strong><br>
     + All code in web app<br>
     - Can not install in hosted environment.  </p>
  
  <p><strong>4) SQL Server Job to call a Webservice (via CLR)</strong><br>
     ? Haven't looked at this.. possible? reliable in hosted environment?  </p>
  
  <p><strong>5) SQL Service Broker Timer to add message to call WebService (via CLR)</strong><br>
     ? Haven't looked at this.. possible? reliable in hosted environment?  </p>
  
  <p><strong>6) Windows Workflow?</strong><br>
     ? No Idea.. does this technology have anything for this?  </p>
  
  <p>This seems like a common enough problem, are there third party tools to handle this?</p>