locked
The remote server returned an error: (500) Internal Server Error RRS feed

  • Question

  • User-1210839387 posted

    I have a VB.Net application where I am posting to an HTTP server that has a classic asp page and I am getting the following exception

    (it's throwing the exception on line 13).  Does anyone know how to troubleshoot this?  thanks 

    :

    <EXCEPTION>

    The remote server returned an error: (500) Internal Server Error

    </EXCEPTION>

    1                            PostData = "externalID=" ID

    2                            Dim strPath As String = "http://200.000.00.00/userfiles/someclassicasppage.asp"
    3                            request = CType(WebRequest.Create(strPath), HttpWebRequest)
    4                            request.ContentType = "application/x-www-form-urlencoded"
    5                            request.ContentLength = PostData.Length
    6                            request.Method = "POST"
    7                            request.AllowAutoRedirect = False
    8    
    9                            Dim requestStream As Stream = request.GetRequestStream()
    10                           Dim postBytes As Byte() = Encoding.ASCII.GetBytes(PostData)
    11                           requestStream.Write(postBytes, 0, postBytes.Length)
    12                           requestStream.Close()
    13                           response = CType(request.GetResponse(), System.Net.HttpWebResponse)
    
      
    Monday, June 11, 2007 2:41 PM

Answers

  • User764044152 posted

    I have something very similar - a VB.net app calling a classic ASP page. Maybe you can try my code (it works in my app in a function)

    Dim sURL As String = "http://testurl/secure/retrieve.asp?POLNUM=" & sPolNum & ""
    
                    Dim sReturn As String = ""
    
            With WebRequest.Create(New Uri(sURL)).GetResponse()
                With New StreamReader(.GetResponseStream())
                    sReturn = .ReadToEnd()
                End With
            End With
    
            Return sReturn
     
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 11, 2007 3:18 PM