Basically you need a fire-n-forget implementation where you can just fire an async operation without waiting for it to finish.
Check out the following answer on a related question.
The code is in C#.Net, but vb.net should be similar.
Edit: Vb.net Solution:
This is the vb.net solution to fire a web method asynchronously:
Consider your web method as follows:
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Sub LengthyProcess()
'Perform the lengthy operation
'Also note this doesn't return anything
'Hence can be used safely in fire-n-forget way of asynchronous delegate
System.Threading.Thread.Sleep(1000)
System.IO.File.WriteAllText("C:\\MyFile.txt", "This is the content to write!", Encoding.UTF8)
System.Threading.Thread.Sleep(1000)
End Sub
End Class
Now to call the web method asynchronously you can do either of the following depending your version of .Net:
.Net 3.5 (I am not sure if it works in 2.0)
Make sure to set Async="true" in your Page directive
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="WebApplication1._Default" Async="true" %>
And in the code behind:
Partial Public Class _Default
Inherits System.Web.UI.Page
Dim webService As MyService.Service1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
webService = New MyService.Service1()
webService.LengthyProcessAsync()
End Sub
End Class
.Net 2.0/ 1.0
No need to set Async="true"
And in the code-behind:
Partial Public Class _Default
Inherits System.Web.UI.Page
Public Delegate Sub MyDelegateCallBack()
Dim webService As MyService.Service1
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click
webService = New MyService.Service1()
Dim del As MyDelegateCallBack
del = New MyDelegateCallBack(AddressOf webService.LengthyProcess)
del.BeginInvoke(Nothing, Nothing)
End Sub
End Class