ASP.NET DEVELOPRS error: 405 Method Not Allowed

From: feedback@webdivisor.com
Date: Sat Nov 22 2003 - 17:54:16 EST


Hello:

    I am just bugging around with OpenSRS API with ASP.NET, I tried to execute the following code that jwr4@einfosystems.net gave me a while back. It returns the following error: The remote server returned an error: (405) Method Not Allowed.

Here is the code that I am using:

<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>

<%

Dim result
                Dim payload as string
                Dim req As WebRequest
            Dim RequestStream As Stream
            Dim ReceiveStream As Stream
            Dim sr As StreamReader
            req = WebRequest.Create("http://resellers-test.opensrs.net")
            req.Method = "POST"
            req.ContentType = "application/x-www-form-urlencoded"
                payload ="username=visorx15"
                payload &="&password=testx11"
                payload &="&action=authenticate"
            Dim utf8 As New UTF8Encoding
            Dim arBytes() As Byte = utf8.GetBytes(payload)
            req.ContentLength = arBytes.Length
            RequestStream = req.GetRequestStream()
            RequestStream.Write(arBytes, 0, arBytes.Length)
            RequestStream.Close()
            result = req.GetResponse()
            ReceiveStream = result.GetResponseStream()
            sr = New StreamReader(ReceiveStream, System.Text.Encoding.GetEncoding("utf-8"))
            Dim resp As String = sr.ReadToEnd
            response.write(resp)

response.write(result)
%>

Any ideas?

Thanks
-Hayk



This archive was generated by hypermail 2.1.3 : Tue Oct 19 2004 - 23:37:50 EDT