How to invoke a function but don't wait to finish - ASP.NET
amazon-s3, asp.net, c#, cron
Solution
Easiest way to do this:
ThreadPool.QueueUserWorkItem(YourUploadMethod);
There is some comment below arguing with this, so I wrote this:
protected void Page_Load(object sender, EventArgs e)
{
ThreadPool.QueueUserWorkItem(YourUploadMethod);
Response.Redirect("http://google.com");
}
public void YourUploadMethod(object state)
{
Thread.Sleep(7000);
}// breakpoint: I was redirected to google and then debugger stopped me here
Problem
I got one page where i do some file manipulation, and when file is done, i need to upload to amazon s3. Sometimes file can be large, so user on submit need to wait too much. How can i make something like - File manipulation - When is done, i send file name parameters to some function - I don't need to wait for that function, i want to use Response.Redirect before uploading is done.