What happens if I turn off the thread to complete a lengthy process right before the ASP.NET page life cycle ends? Will ASP.NET runtime kill a thread? Could this lead to undefined behavior?
Here's a sample code that rotates the background thread in the Page_Load event. Is this a safe thing?
protected void Page_Load(object sender, EventArgs e)
{
Thread newThread = new Thread(new ThreadStart(SomeLongRunningMethod));
newThread.IsBackground = true;
newThread.Start();
}
private void SomeLongRunningMethod()
{
}
source
share