Possible Duplicate:
ASP.Net:Best way to run scheduled tasks
How to fire a server side action after 10 minutes in ASP.NET using C#
For example of, if user creates an account and if his account is kept inactive for 12 hours how to automatically delete his account. I need something related to this kind of example.
There should be no relation with browser. Once the user logs out of his account his some server side action to be performed automatically after some certain time.
i would setup a Timer Method in the global.asax, which then can do the cleanup operations.
Therefor you add the following code to the Application_Start:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
‘–Save Translations every 15minutes, starting 15sec after appstart
Dim TimerDelegate As Threading.TimerCallback = AddressOf Manager.DoWork
Dim MyTimer As Threading.Timer = New Threading.Timer(TimerDelegate, Nothing, TimeSpan.FromSeconds(15), TimeSpan.FromMinutes(10))
End Sub
and implement a e.g. Manager with the Worker-Method:
Manager.vb:
public shared sub DoWork()
‘–Dow the work…
end sub