Question : help me : The remote server returned an error: (501) Not Implemented.

Please help me to solve this problem. I am trying to get back the response from USPS shipping API .

   But I get this error only,

        Exception Details: System.Net.WebException: The remote server returned an error: (501) Not Implemented.

I have tried a lot with both "POST" and "GET" methods, but I can't solve it.


   Dim Req As Net.HttpWebRequest = Net.WebRequest.Create(url)
        Response.Write("3")
        Req.Method = "POST"
        Req.AllowAutoRedirect = True
        postdata = para + res
        Req.Timeout = 100000

        Req.ContentLength = postdata.Length
        Req.ContentType = "text/XML"
        Req.ContentLength = postdata.Length
        Req.KeepAlive = False

        Dim writer As New IO.StreamWriter(Req.GetRequestStream)
        writer.Write(postdata)
        writer.Close()

        Dim result As String
        Dim objResponse As Net.HttpWebResponse = Req.GetResponse()
        Dim sr As StreamReader
        sr = New StreamReader(objResponse.GetResponseStream())
        result = sr.ReadToEnd
        Response.Write(result)
        sr.Close()


   Please if anybody who know this, please come forward to help me to solve this issue.

   Waiting for your replay...

Answer : help me : The remote server returned an error: (501) Not Implemented.

Hi,

501 (not implemented) usually means that the remote server does not like the http method specified (i.e. Req.Method = "POST") or that your request does not specify http 1.1

If Net.WebRequest object has a http1.1 propertyl turn that on.  Else try setting Req.Method = "GET" perhaps.

Note that the error is on the REMOTE server, not on your own system - so you may need to deal with the service provider to get it sorted out.

Cheers.
Random Solutions  
 
programming4us programming4us