40 minutes?! Surely you don't expect the user to hang around while that happens...? It doens't matter what code you use if they simply shut their computer down... ..on the assumption that all that matters is that your long running process is initiated by them, but they don;t need to wait for the result (you could always show it to them next time they log on), then you can accomplish this by calling a new HttpWebRequest, whcih will run in a new thread and won't be affected by what the user does once it is invoked. You will, by the sound of it, need to set/increase the ScriptTimeout property of your long running process. Place your long running process in a generivc handler ("longrunning.ashx"), then call this from your server-side code as follows:
Dim rq As System.Net.HttpWebRequest = DirectCast(System.Net.WebRequest.Create("longrunning.ashx"), System.Net.HttpWebRequest)
rq.Method = "POST"
rq.ContentType = "application/x-www-form-urlencoded"
Dim postData As String = "" ' any data that needs to be passed to the handler
rq.ContentLength = postData.Length
Dim writer As New System.IO.StreamWriter(rq.GetRequestStream(), System.Text.Encoding.ASCII)
writer.Write(postData)
writer.Close()
Note that you should specify the full URL (http path) to "longrunning.ashx", not just the handler filename as I have above. I can only giove you VB code for this I'm afraid - after that you;re on your own...