dragonfly
dragonfly

Reputation: 17783

Trigger event automatically once per 24h / per user in ASP .NET Application

What selection of solution do I have if I want to launch particular piece of code for logged in user, but not more often then once per day (it can change in the future to run once per 6 hours though). I though about setting a cookie that will store a date when code was launched the last time, but I still have to check that cookie's value with every request in global.asax when request start event is raised. Are there any other more efficient solutions?

Ah, and also that event result is particular JavaScript code being rendered to user's page. So I need HttpResponse instance when the event is launched.

Thanks,Pawel

Upvotes: 2

Views: 1496

Answers (2)

E.J. Brennan
E.J. Brennan

Reputation: 46879

quartz.net comes to mind (maybe overkill for you, but worth a look)

Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems.

http://quartznet.sourceforge.net/

Upvotes: 1

Dave Walker
Dave Walker

Reputation: 3523

You could use your cookie and a restful ajax call (back to the server to check for changes). Use HTTP Caching to ensure that it only happens at min once every 24 hrs (so set cache for +24hrs).

Everytime the result completes it will display the new text. Store a variable guid or somethign to ensure don't display the same one twice.

Upvotes: 2

Related Questions