I have the following code in my codebehind (aspx.cs):
protected void button1_Click(object sender, EventArgs e)
{
new Thread(delegate() {
try
Providing another solution: you don't need to set your page with the async
property. The following code will work fine:
new Thread
(
delegate()
{
try
{
MyMethod(myVar);
}
catch (Exception ex)
{
// handle
}
}
)
{
IsBackground = true
}.Start();
In this code, IsBackground = true
is what prevents the thread to be aborted when the request finishes.