WebClient.UploadFile() --Urgent !!!

WebClient.UploadFile() --Urgent !!!

Post by Sefa Sevteki » Thu, 07 Mar 2002 01:03:12



Hi,

I am trying to upload a file using WebClient.Upload
method.Here is the error message I am getting:
-----------------------------------------------------------
The remote server returned an error: (405) Method Not
Allowed.
Description: An unhandled exception occurred during the
execution of the current web request. Please review the
stack trace for more information about the error and where
it originated in the code.

Exception Details: System.Net.WebException: The remote
server returned an error: (405) Method Not Allowed.

Source Error:

Line 26:                        string
fileName="c:\\test.txt";
Line 27:                        WebClient wc=new WebClient
();            
Line 28:                        byte[] responseArray =
wc.UploadFile(uri,"POST",fileName);
Line 29:                        //Encoding.ASCII.GetString
(responseArray)
Line 30:                }

Source File:
c:\inetpub\wwwroot\sevtekin\pdfmaker.aspx.cs    Line: 28

Stack Trace:

[WebException: The remote server returned an error: (405)
Method Not Allowed.]
   System.Net.HttpWebRequest.CheckFinalStatus() +684
   System.Net.HttpWebRequest.EndGetResponse(IAsyncResult
asyncResult) +139
   System.Net.HttpWebRequest.GetResponse() +147
   System.Net.WebClient.UploadFile(String address, String
method, String fileName) +1196
   sevtekin.pdfmaker.Page_Load(Object sender, EventArgs e)
in c:\inetpub\wwwroot\sevtekin\pdfmaker.aspx.cs:28
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +29
   System.Web.UI.Page.ProcessRequestMain() +724
-----------------------------------------------------------

I checked the directory permissions and they seem all
OK.Any Ideas??

 
 
 

WebClient.UploadFile() --Urgent !!!

Post by Michael Giagnocav » Thu, 07 Mar 2002 01:20:40


Sounds like someone disabled POST.  Check the IIS app settings.
-mike

> Hi,

> I am trying to upload a file using WebClient.Upload
> method.Here is the error message I am getting:
> -----------------------------------------------------------
> The remote server returned an error: (405) Method Not
> Allowed.
> Description: An unhandled exception occurred during the
> execution of the current web request. Please review the
> stack trace for more information about the error and where
> it originated in the code.

> Exception Details: System.Net.WebException: The remote
> server returned an error: (405) Method Not Allowed.

> Source Error:

> Line 26: string
> fileName="c:\\test.txt";
> Line 27: WebClient wc=new WebClient
> ();
> Line 28: byte[] responseArray =
> wc.UploadFile(uri,"POST",fileName);
> Line 29: //Encoding.ASCII.GetString
> (responseArray)
> Line 30: }

> Source File:
> c:\inetpub\wwwroot\sevtekin\pdfmaker.aspx.cs    Line: 28

> Stack Trace:

> [WebException: The remote server returned an error: (405)
> Method Not Allowed.]
>    System.Net.HttpWebRequest.CheckFinalStatus() +684
>    System.Net.HttpWebRequest.EndGetResponse(IAsyncResult
> asyncResult) +139
>    System.Net.HttpWebRequest.GetResponse() +147
>    System.Net.WebClient.UploadFile(String address, String
> method, String fileName) +1196
>    sevtekin.pdfmaker.Page_Load(Object sender, EventArgs e)
> in c:\inetpub\wwwroot\sevtekin\pdfmaker.aspx.cs:28
>    System.Web.UI.Control.OnLoad(EventArgs e) +67
>    System.Web.UI.Control.LoadRecursive() +29
>    System.Web.UI.Page.ProcessRequestMain() +724
> -----------------------------------------------------------

> I checked the directory permissions and they seem all
> OK.Any Ideas??


 
 
 

WebClient.UploadFile() --Urgent !!!

Post by Bryan Slatn » Fri, 08 Mar 2002 05:34:11


One common reason that you'd see this is when you upload from your default
document and, for some reason, the <form> tag doesn't have an explicit
"action" attribute. You might want to check that.

When you receive this error, IIS will place information about it in the
event log. Can you look up that information in your event log and post it
here? That will hopefully give us a better idea of what's causing your
problem.

--
Bryan Slatner
Microsoft ASP.NET Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.