troubleshooting Question

Exit Async Webrequest

Avatar of Ruttensoft
Ruttensoft asked on
Visual Basic.NET
1 Comment1 Solution408 ViewsLast Modified:
Hello

I am making a connection to a webservice and the whole process takes about 15 seconds

While this time, the application is stuck (I'm programm for a device), so I have now changed to async webrequest which is working great!
Now I can Push the "Abort"-Button and it is asking if I want to stop the whole process. Before it asked only after the whole process

My problem is that I dont know how to end the async webrequest.

This is the async call:

                    Dim asyncCallback As New AsyncCallback(AddressOf FinishSum)
                    srvcon.BeginCheckRegistration(username, password, 1, 2, 3, asyncCallback, Nothing)
                    While a = ""         ' Here I am waiting for the result, while that I can press on Abort which sets Abbruch to true
                        If abbruch = True Then
                            GoTo gh
                        End If
                        Application.DoEvents()
                        System.Threading.Thread.Sleep(100)
                    End While

and this the result

    Public Sub FinishSum(ByVal IAsyncResult As IAsyncResult)
        a = srvcon.EndCheckRegistration(IAsyncResult)
    End Sub



But now if I exit it (goto gh), the webrequest is still running in another thread and returns after 15 seconds a value...
How can I stop it?

Thanks

Sven
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros