473,748 Members | 9,416 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.WebC lient MyClient = new System.Net.WebC lient();

MyStream = MyClient.OpenWr ite(SaveAddress , "PUT");
MyStreamWriter = new System.IO.Strea mWriter(MyStrea m);

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

//close the writer.

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


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

Additional information:
Nov 16 '05 #1
2 17410
"genc ymeri" <ge********@hot mail.com> wrote in message news:%2******** ********@TK2MSF TNGP12.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.OpenWr ite(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******** ********@TK2MSF TNGP11.phx.gbl. ..
"genc ymeri" <ge********@hot mail.com> wrote in message

news:%2******** ********@TK2MSF TNGP12.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.OpenWr ite(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
5901
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 docs - http://twistedmatrix.com/users/warner/doc-latest/web/howto/using-twistedweb.xhtml Configuring and Using the Twisted.Web Server - Twisted Web Development.
1
2306
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 allowed" that "post" method is not allowed? I looked at the code which is: <form action="send_email.asp" method="post" onSubmit="return checkform();"> . Its there a file or application missing with the new hosting company? Any help would be greatly...
5
11017
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 code. Also error comes only sometimes. var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); xmlhttp.Open("POST", "test.aspx?qsVar="+qsVar, false); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.Send(xmldoc);
2
1928
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 "Company" or "Products",It will show the actual url in the address bar but it gives a error "405 - resource not allowed". Kindly check and let me know the solution for this. If you know any other simple script similar to this let me know....
3
2396
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 = "C:\\agoodfriend.jpg"; byte responseArray = myWebClient.UploadFile (uriString,"POST",fileName); ---------------------------------------- But I get the following error:
1
1177
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 my Intranet location as follows; Dim MyClient As System.Net.WebClient MyClient.UploadFile(myWebaddress, myfile) where I've set the values as; myWebaddress = "http://myserver/sample/" and myfile = "C:\Temp\Temp.txt".
0
1525
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 need to configure at the DB server? Tx!
0
2925
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 = WebRequest.Create("http://127.0.0.1/virtualdirectory/")
1
1427
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: protected void Page_Load(object sender, EventArgs e) { return }
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.