Problem with spawning new thread in ASP.NEt

  • Thread starter Thread starter n#
  • Start date Start date
N

n#

I have a long running task to be called from an aspx page.

My code segment

Dim ts As ThreadStart = New ThreadStart(AddressOf runLRProcessAsync)
Dim workerThread As Thread = New Thread(ts)
workerThread.Name = "LRProcess1"
workerThread.Start()
Response.Redirect("LRProcessResult.aspx?Refresh=N)


Everything works fine when the long running process is really a time
consuming operation.
But in some cases when the long running process is not really that
long, my response.redirect never gets executed.
I introduced aritifical slow downs by using Thread.Sleep. But of no
use.

Please help me.
 
Hi,
just try this one:
Response.Redirect("LRProcessResult.aspx?Refresh=N",True)

Thanks and Regards,
Manish Bafna.
MCP and MCTS.
 
Actually i got the ThreadAbort Exception, but when I tried

Response.Redirect(url, false);
HttpContext.Current.ApplicationInstance.CompleteRequest();

Still my page freezes.
 
Back
Top