WebRequest works on two machines, but not on a third.

Discussion in 'ASP .Net' started by clockemail@alltel.net, Jul 18, 2007.

  1. Guest

    I am using a web request in VB.Net to screen scrape a page on Server
    X. The code works on my machine and another server when making the
    call to Server X. However, if I use the code on Server X itself, the
    following error is returned.

    The underlying connection was closed: Unable to connect to the remote
    server. at System.Net.HttpWebRequest.CheckFinalStatus() at
    System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at
    System.Net.HttpWebRequest.GetResponse()

    The relevant code is as follows, in which url represents the address
    of the web page from which the information is being read.

    Dim result As WebResponse = Nothing
    Dim strHTML As String = String.Empty
    Dim SR As StreamReader = Nothing
    Dim Req As WebRequest = WebRequest.Create(url)
    Req.Credentials = CredentialCache.DefaultCredentials
    Req.Proxy = WebProxy.GetDefaultProxy()
    result = Req.GetResponse()
    Dim stReceive As Stream = result.GetResponseStream()
    SR = New StreamReader(stReceive)
    strHTML = SR.ReadToEnd()
    If Not result Is Nothing Then
    result.Close()
    result = Nothing
    End If
    If Not SR Is Nothing Then
    SR.Close()
    SR = Nothing
    End If

    I would be extremely grateful to anyone who could inform me of the
    cause of the problem. The only possible cause I have found in other
    postings is the use of a proxy server on Server X (I am waiting to
    hear if a proxy server is being used). I would be even more grateful
    for a solution to the problem.
     
    , Jul 18, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    369
    Juan T. Llibre
    Jul 20, 2006
  2. F. GEIGER
    Replies:
    3
    Views:
    816
    F. GEIGER
    Aug 6, 2004
  3. GGP
    Replies:
    2
    Views:
    477
    Paul Tomblin
    Mar 17, 2007
  4. ASPQuicky
    Replies:
    0
    Views:
    127
    ASPQuicky
    Oct 13, 2004
  5. Replies:
    0
    Views:
    140
Loading...

Share This Page