The remote server returned an error: (405) Method Not Allowed.

J

John

Hi,

I am getting this error message
The remote server returned an error: (405) Method Not Allowed.
while trying to execute the following code:


Dim myReq As HttpWebRequest =
WebRequest.Create("http://127.0.0.1/virtualdirectory/")


myReq.ContentType = "application/x-www-form-urlencoded"
myReq.Method = "POST"
Dim Tmp As String
Dim srMyReader As New StreamReader("C:\Temp\appupdater.xml")
Tmp = srMyReader.ReadToEnd
srMyReader.Close()
Dim encodedData As New System.Text.UTF8Encoding
Dim byteArray As Byte() = encodedData.GetBytes(Tmp)
Dim newStream As Stream = myReq.GetRequestStream()
newStream.Write(byteArray, 0, Tmp.Length)
newStream.Close()

Try
Dim response As HttpWebResponse =
CType(myReq.GetResponse(), HttpWebResponse)
Catch ex As Exception
response.Write(ex.Message)
End Try

I am trying to upload xml file to virtual directory.
I checked IIS/Configuration/aspx is limited to GET,HEAD,POST,DEBUG
What else could cause this error?
I also created much simpler html code
<form name="somename" target="sometarget"
action="http://127.0.0.1/virtualdirectory/" method="post">

<input type="submit">
</form>
which also won't execute. I am getting error
HTTP 405 - Resource not allowed
Internet Information Services

--------------------------------------------------------------------------------
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top