473,408 Members | 2,477 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,408 software developers and data experts.

http file upload from c# windows application

I've a C# windows application (not asp.net) that needs to upload
simple XML files to a URL on a website.

I've tried WebClient such as

WebClient Client= new WebClient();
Client.UploadFile(url,filePath);

but get error (405) Method not allowed.

I've got write permissions set on the remote folder. Do I need
identity impersonate=true?
I know how to set this in a web config in asp.net but not in a C#
windows application.

Any suggestions.

John South
WhereCanWeGo.com

Jun 13 '06 #1
1 25346
Thus wrote JohnSouth,
I've a C# windows application (not asp.net) that needs to upload
simple XML files to a URL on a website.

I've tried WebClient such as

WebClient Client= new WebClient();
Client.UploadFile(url,filePath);
but get error (405) Method not allowed.

I've got write permissions set on the remote folder. Do I need
identity impersonate=true?
I know how to set this in a web config in asp.net but not in a C#
windows application.
Any suggestions.


If you're trying to write directly to the host (i.e. there's no web application
in between receiving the file), use
client.UploadFile(url, "PUT", filePath);

Also, make sure that "url" contains the actual filename to put the file to,
i.e. http://host/path/to/foo.txt.

Cheers,
--
Joerg Jooss
ne********@joergjooss.de
Jun 13 '06 #2

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

Similar topics

2
by: Daniel López | last post by:
Anyone know how can I upload a file to a PHP Web Form from a C# Windows Application ? I've tried to use WebClient.UploadFile("path_file_to_upload","url_of_php_form"); but with this I don't...
2
by: mt | last post by:
Is there a way to upload a file to a different server other than the one hosting the web app? I've tried using the following syntax: Request.Files.SaveAs("\\\\servername\\sharename\\directory" +...
2
by: Andy Johns | last post by:
I've seen plenty of examples of file uploads in ASP.NET when the only form element is the file input type, but I've not seen a practical example of a file upload routine running alongside other...
1
by: Jason Ho | last post by:
Hi, I would like to send a jpg file to a HTTP server by POST request. But I am not using a browser to do this, I use a Windows Form instead. I know how to send typical request by POST with code...
0
by: ukwebguy | last post by:
Hi, I'm using Persits ASP Upload to upload files to a simple document management application running on Windows Server 2003. At the moment I've set the OVERWRITEFILES property to FALSE so every...
13
by: MCPD | last post by:
hello i have an aspx page that write in javascript its too small file when i upload it to my website i got an error Server Error in '/' Application....
3
by: Paul Wardle | last post by:
Hi I have written a program to upload files using ftp/http. So far, so good, I have coded my solution. Now I need to test it. I have access to an ftp site and the ftp upload works OK. I now...
0
by: cw808 | last post by:
Hi all. I'm new here but hoping I can get some help for my problem. My situation is that I need to upload files through a C# .NET web application to a file server. I done a search and followed...
2
Manikgisl
by: Manikgisl | last post by:
we are trying to upload a file using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Net;
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: 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...
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
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,...
0
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...
0
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...
0
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,...

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.