.NET sucks - unhandled exception

Discussion in 'OT Technology' started by Slid., Jul 22, 2004.

  1. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    Okay, I installed Visual Studio .NET today - I bought it to make my life easier but it is just giving me a headache. I'm attempting to do something very simple - get the source from a webpage. If I can get the source I'll clean it up and turn it into an auto-updated for a program I want to write.

    I am coding in VB .NET.

    I am using this function:

    Code:
        Private Function getSource(ByVal URL As String) As String
            'Set URL
            Dim objResponse As Net.WebResponse
            Dim objRequest As Net.WebRequest
            objRequest = Net.HttpWebRequest.Create(URL)
            objResponse = objRequest.GetResponse
            'Grab data from URL
            Dim sr As System.IO.StreamReader = New System.IO.StreamReader(objResponse.GetResponseStream())
            'return the source
            Return sr.ReadToEnd()
        End Function
    
    When I make a call to it I get this error:

    Code:
    An unhandled exception of type 'System.NotSupportedException' occurred in system.dll
    
    Additional information: The ServicePointManager does not support proxies of file scheme.
    
    All I am doing is plopping that function down then making a call to it - I'm not adding any controls or references (should I be?) I've tried everything I can think of but it just won't work.

    Any ideas? This is really important 'cause I'm going to burn this software tomorrow.
     
  2. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    Put a TRY.... CATCH around your code and catch an error object of type Exception(), then look at it's properties to get more info. That should be your first step when debugging .NET code.
     

Share This Page