473,385 Members | 1,655 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,385 software developers and data experts.

HTTP 405 Method Not allowed

Manikgisl
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 8746
kenobewan
4,871 Expert 4TB
Not sure why you posted to IIS forum? Looks like a coding problem, try debugging.
Dec 31 '08 #2
Frinavale
9,735 Expert Mod 8TB
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/OETAdminWebService/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
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...
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...
2
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...
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...
10
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...
3
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...
5
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...
0
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...
3
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.