473,466 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 25361
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: 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,...
0
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...
1
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
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,...
0
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...
0
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...

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.