Results 1 to 2 of 2

Thread: [RESOLVED] [2005] WebException halts execution

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Resolved [RESOLVED] [2005] WebException halts execution

    When I use this code...
    VB Code:
    1. Private Function CheckURL(ByVal site As String) As Boolean
    2.         Dim request As System.Net.WebRequest
    3.         Try
    4.             Dim url As New System.Uri(site)
    5.             request = System.Net.WebRequest.Create(url)
    6.             Dim response As System.Net.WebResponse = request.GetResponse()
    7.             response.Close()
    8.             request = Nothing
    9.             Return True
    10.         Catch
    11.             request = Nothing
    12.             Return False
    13.         End Try
    14.     End Function
    With...
    VB Code:
    1. MsgBox(CheckURL("http://www.google.com"))
    2.         MsgBox(CheckURL("http://www.googlexyz.com"))

    the IDE stops execution on the second URL and throws up the exception dialog box. If I step it forward, it moves onto the Catch correctly. Is there a way to prevent the IDE stopping when it hits a WebException? (It only seems to do this with a WebException). I'd like the code to proceed onto the Catch without my intervention.

    If I build the solution, it works correctly (but then I cant do any debugging).

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] WebException halts execution

    I think I've answered my own question...

    Debug -> Exceptions.. -> Uncheck the System.Net.WebExceptions "Thrown" checkbox

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width