473,378 Members | 1,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

I'm uploading a text through http server but I keep getting the below error.
Is the below error coming from my code or from the http server ???? Any
help/tip will be very much appreciated. Thank You very much in advance.
try
{
//create an instance of the WebClient.
System.Net.WebClient MyClient = new System.Net.WebClient();

MyStream = MyClient.OpenWrite(SaveAddress, "PUT");
MyStreamWriter = new System.IO.StreamWriter(MyStream);

//grab the stream and write the output.
MyStreamWriter.Write(textOutput.Text);

//close the writer.

MyStreamWriter.Close();
MessageBox.Show("File has been created!");
}
catch (System.Net.WebException ex)
{
MessageBox.Show(ex.Message);
}


Error:
An unhandled exception of type 'System.Net.WebException' occurred in
system.dll

Additional information:
Nov 16 '05 #1
2 17373
"genc ymeri" <ge********@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
I'm uploading a text through http server but I keep getting the below error.
Is the below error coming from my code or from the http server ? : : MyStream = MyClient.OpenWrite(SaveAddress, "PUT");


The message is coming from the HTTP server, it's an HTTP
status code. This means your request was received by the
server, but it will not accept it.

The HTTP server is telling you that it doesn't support PUT for
the URL (SaveAddress) you're requesting, so it will do you no
good to send it HTTP requests that start out,

HTTP/1.0 PUT blah/blah.balah

because it will always respond,

HTTP/1.0 405 Method Not Allowed
Allow: GET, POST {possibly other methods, but evidently not PUT}

and be done with your request. See RFC 2616 for more explanation
on the significance of possible HTTP Status Codes, like 405,

http://www.w3.org/Protocols/rfc2616/...html#sec10.4.6
Derek Harmon
Nov 16 '05 #2
Should I set somewhere what kind of format the file I'm loading is ??? I'm
trying to load a simple small XML file in TomCat webserver but the error we
are getting is saying that is not multi-part form or something.

Any idea ???? Is that something we have to take care in C# web client ????

"Derek Harmon" <lo*******@msn.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
"genc ymeri" <ge********@hotmail.com> wrote in message

news:%2****************@TK2MSFTNGP12.phx.gbl...
I'm uploading a text through http server but I keep getting the below error. Is the below error coming from my code or from the http server ?

: :
MyStream = MyClient.OpenWrite(SaveAddress, "PUT");


The message is coming from the HTTP server, it's an HTTP
status code. This means your request was received by the
server, but it will not accept it.

The HTTP server is telling you that it doesn't support PUT for
the URL (SaveAddress) you're requesting, so it will do you no
good to send it HTTP requests that start out,

HTTP/1.0 PUT blah/blah.balah

because it will always respond,

HTTP/1.0 405 Method Not Allowed
Allow: GET, POST {possibly other methods, but evidently not PUT}

and be done with your request. See RFC 2616 for more explanation
on the significance of possible HTTP Status Codes, like 405,

http://www.w3.org/Protocols/rfc2616/...html#sec10.4.6
Derek Harmon

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: qwejohn | last post by:
Hello, I had posted this question in the twisted mailing list but did not got a solution ; I hope that the python Gurus of this forum can help me a bit. I am trying the exmaple in the python...
1
by: | last post by:
A friend of mine has a website that is ASP. I know nothing about ASP. He switched hosting and now his "contact us" form does not work. When you hit submit it gives an error "Error 405 Method not...
5
by: RK | last post by:
I am getting the "HTTP /1.1 405 - method not allowed" error when I am sending XML string over Msxml2.XMLHTTP object. I am sending data in POST, also passing querystring variable and here is the...
2
by: minchu | last post by:
Hello friends, I don't know about scripting. I have created a site with menu, it is working fine locally but when i upload it on the server it dosen't work. When I click on submenu under...
3
by: Mariela | last post by:
I am trying to run the following C# code: ---------------------------------------- String uriString = "http://10.1.1.100/images/"; WebClient myWebClient = new WebClient(); string fileName =...
1
by: Rob Maui | last post by:
I've tried getting a problem resolved from the Windows forum, but I figure maybe someone here might know the answer to my problem. I have a Windows application and I am trying to upload a file to...
0
by: Rocio | last post by:
What do I need to do to solve this? I wrote a web service that is running ona DB server. The consumer application, running in another server, wants to upload a file to the DB server. What do I...
0
by: John | last post by:
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 =...
1
by: Piotrekk | last post by:
Hi My application is uploading the file to the ASP script. I am dealing with situation where ASP script is not interested in receiving a file. I simulate this by returning from ASP script: ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.