I have a asp.net web application , in that application I will call a function once that function s called , it has to wait for some time interval then execution should take place how to do that.......
-
Why do want this? What are you trying to achieve?Sjoerd– Sjoerd2012-07-18 10:42:03 +00:00Commented Jul 18, 2012 at 10:42
-
Timer is related to threads and in server side programming you are not supposed to use threads. You have to make it to work alternatively for whatever you want to do. First you see whether what you need to achieve is possible thru different event trigger or can do same using Javascript ajax call or some other means.Harshith J.V.– Harshith J.V.2012-07-18 10:53:31 +00:00Commented Jul 18, 2012 at 10:53
Add a comment
|
3 Answers
Sleeping or delaying the thread in asp.net is not recommended. If you need to to retrieve some data after a specific period of time, make an ajax call through javascript after a period of time.
If you want to perform some action (such as sending an email) after some time, create a service or a console application that you can run on a timer, create some sort of persistent queue, and have said service process the items in the queue.
This will allow your app to remain quick and responsive while still performing the actions you require.