473,836 Members | 2,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTTP 405 Method Not allowed

Manikgisl
37 New Member
we are trying to upload a file

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7. using System.Net;
  8.  
  9. namespace WindowsApplication3
  10. {
  11.     /// <summary>
  12.     /// Summary description for Form1.
  13.     /// </summary>
  14.     public class Form1 : System.Windows.Forms.Form
  15.     {
  16.         private System.Windows.Forms.Button button1;
  17.         /// <summary>
  18.         /// Required designer variable.
  19.         /// </summary>
  20.         private System.ComponentModel.Container components = null;
  21.  
  22.         public Form1()
  23.         {
  24.  
  25.             InitializeComponent();
  26.  
  27.  
  28.         }
  29.  
  30.         /// <summary>
  31.         /// Clean up any resources being used.
  32.         /// </summary>
  33.         protected override void Dispose( bool disposing )
  34.         {
  35.             if( disposing )
  36.             {
  37.                 if (components != null) 
  38.                 {
  39.                     components.Dispose();
  40.                 }
  41.             }
  42.             base.Dispose( disposing );
  43.         }
  44.  
  45.         #region Windows Form Designer generated code
  46.         /// <summary>
  47.         /// Required method for Designer support - do not modify
  48.         /// the contents of this method with the code editor.
  49.         /// </summary>
  50.         private void InitializeComponent()
  51.         {
  52.             this.button1 = new System.Windows.Forms.Button();
  53.             this.SuspendLayout();
  54.             // 
  55.             // button1
  56.             // 
  57.             this.button1.Location = new System.Drawing.Point(104, 96);
  58.             this.button1.Name = "button1";
  59.             this.button1.TabIndex = 0;
  60.             this.button1.Text = "button1";
  61.             this.button1.Click += new System.EventHandler(this.button1_Click);
  62.             // 
  63.             // Form1
  64.             // 
  65.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  66.             this.ClientSize = new System.Drawing.Size(292, 273);
  67.             this.Controls.Add(this.button1);
  68.             this.Name = "Form1";
  69.             this.Text = "Form1";
  70.             this.ResumeLayout(false);
  71.  
  72.         }
  73.         #endregion
  74.  
  75.         /// <summary>
  76.         /// The main entry point for the application.
  77.         /// </summary>
  78.         [STAThread]
  79.         static void Main() 
  80.         {
  81.             Application.Run(new Form1());
  82.         }
  83.  
  84.         private void button1_Click(object sender, System.EventArgs e)
  85.         {
  86.             fnUpload();
  87.         }
  88.         public void fnUpload()
  89.         {
  90.             try
  91.             {
  92.                 WebClient  Client = new WebClient();
  93.                 //Client.UploadFile("http://www.csharpfriends.com/Members/index.aspx", "c:\wesiteFiles\newfile.aspx");
  94.                 Client.UploadFile("http://10.100.7.143/OETAdminWebService/123.zip", "C:\\123.zip");
  95.  
  96.  
  97.             }
  98.             catch(Exception ex)
  99.             {
  100.                 MessageBox.Show(ex.Message);
  101.             }
  102.         }
  103.     }
  104. }
while download its works

but upload is not working throwing an exception

HTTP 405 Method not allowed


we are change settings but its not working


thanks in advance

Happy New Year

With Regards,
Mani
Dec 30 '08 #1
2 8817
kenobewan
4,871 Recognized Expert Specialist
Not sure why you posted to IIS forum? Looks like a coding problem, try debugging.
Dec 31 '08 #2
Frinavale
9,735 Recognized Expert Moderator Expert
A 405 error indicates:

The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.

Check to make sure that you are allowed to access the resource:
"http://10.100.7.143/OETAdminWebServ ice/123.zip"


Also, if the underlying request does not use HTTP or POST, the request for the resource is not understood by the server and a WebException is thrown with the Status property set to indicate the error.


So, make sure that the underlying request uses HTTP and POST.
For example:
Expand|Select|Wrap|Line Numbers
  1. String uriString = "http://10.100.7.143/OETAdminWebService/123.zip";
  2. String fileName = "C:\\123.zip";
  3. String method = "POST";
  4.  
  5. // Upload the file to the URL using the HTTP 1.0 POST.
  6. byte[] responseArray = Client.UploadFile(uriString, method, fileName);
  7.  
  8.  

-Frinny
Dec 31 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
13835
by: Rob | last post by:
THis is my code. What im trying to accomplish is the user fills out the form then when they hit submit it displays what the entered on the samne page but i get this error message when I hit submit Method Not Allowed The requested method POST is not allowed for the URL /rob.html. Here is the code. Any helpis greatly appreciated I cant figure this out at all i have tried so many different combinations.
1
5908
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.
2
11333
by: Alex Vinokur | last post by:
========================================= Windows 2000 CYGWIN_NT-5.0 1.3.22(0.78/3/2) GNU gcc version 3.2 20020927 (prerelease) ========================================= Here is some program which is compiled and works fine. ############################################
5
11026
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);
10
3670
by: John Bowman | last post by:
Hello, I need some help getting a callback delegate passed as an argument to a dynamically linked Dll method so it in turn, can eventually call it. Below is the salient portions of code I'm dealing with. It all compiles and all other dynamically linked methods that only pass "regular" arguments (strings, ints, bools, objects, etc.) work great. However, when this portion of code runs and hits the line that acutally invokes the Dll...
3
1957
by: Edward Diener | last post by:
According to the CLS specification, the accessibility of the methods for adding, removing, and raising an event must be identical. There appear to be a few problems with this: 1) According to the Managed C++ specifications, if one declares a public event without any attempt to provide one's own event access methods, clearly the most common case, the compiler generates public add_ and remove_ methods for the event and a protected raise_...
5
50749
by: rk325 | last post by:
Yes, I've seen many posts about this type of error, and none of the solutions people applied worked for me. So please read this one carefully and help me if you can. I have a web service application installed in a Windows 2000 SP4 Domain control server. It is running IIS 5.0. I can access the WS from its own web page, and, when I access it from the server where it is installed, I can run its methods. However, I cannot access this WS...
0
1317
by: Thirsty Traveler | last post by:
This webservice works fine on my local machine, but when I moved it to another workstation, I received the HTTP 405 error stating the method is not allowed. I have tried everything from adding aspnet to security, enabling executables, checking web/machine config files... but am still unable to resolve this problem. Does anyone have any idea on what might be causing it?
3
5856
by: Eric | last post by:
I'm trying to test code to post xml to a web page in anticipation of a new project. I wanted to try a simple test first, but I get a (405) Method Not Allowed error no matter what I try. I have tried posting to the same machine as well as a different machine. Anonymous access is enabled for the virtual directory. I have added Allow POST for All Users for the virtual directory. I tried allow All verbs for all users but the system said that...
0
9810
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
9656
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9358
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...
0
5642
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
5812
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4443
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3102
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.