By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,880 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,880 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

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

Sep 11 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.