473,387 Members | 1,789 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,387 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 25342
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: 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
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
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
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
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...

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.