I am working on a website where i want to call a method every 30 minutes for example. I want that to be done in background while user is freely using the website. After a lot of research i have found the following function.
public static async Task myFunction()
{
//Stuff Happens on the original UI thread
await Task.Run(() => //This code runs on a new thread, control is returned to the caller on the UI thread.
{
while (?)
{
}
//Do Stuff
});
//Stuff Happens on the original UI thread after the loop exits.
}
I do not know i can change that so it calls a method periodically. Please help with actual code as i am new to C# and asp.net
Edit: Quartz.net was a better alternative and it worked for me