?
Solved

Uploading saved files in asp.net

Posted on 2013-01-16
4
Medium Priority
?
230 Views
Last Modified: 2013-02-28
Hi experts!

I'm trying to upload a saved pdf file to webserver but the server is returning an error 404: not found. The IIS 7 is running on my machine where I'm administrador and the folder App has permittion to Everybody (full). I try too include ASPNET user on folder security. For the download process everything works fine but for upload the error appears.

The partial code:

WebClient WebClient = new WebClient();
WebClient.Credentials = CredentialCache.DefaultNetworkCredentials;

string LocalFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "File1.pdf");

WebClient.DownloadFile("http://localhost/App/File1.pdf", LocalFile); /* it works fine */
WebClient.UploadFile("http://localhost/App/File2.pdf", LocalFile); /* it not works */

Any suggestions?
Thanks in advance!
0
Comment
Question by:ZumbaJr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Expert Comment

by:masterpass
ID: 38784503
I think you are referring to the filename in here

WebClient.UploadFile("http://localhost/App/File2.pdf", LocalFile); /* it not works */

try like this :

WebClient.UploadFile("http://localhost/App", LocalFile);

Hope this helps :)
0
 
LVL 8

Expert Comment

by:deepu chandran
ID: 38785968
Have a look at this article,looks like useful for you

http://www.codeproject.com/Articles/8600/UploadFileEx-C-s-WebClient-UploadFile-with-more-fu 

--Deepu
0
 

Author Comment

by:ZumbaJr
ID: 38787140
Hi folks!

The questions that I didn't understood yet is: the UploadFile FileName must be in application machine, not client machine. When I run DownloadFile it downloaded too the application machine. In my case, the same machine, here is the confusion. When I run the application from other host, the files still remains in application machine and when I run UploadFile method with filename paths on the application machine it works. But I'm looking for a method that upload files from Client Machine to Application Machine without use file form field to do it, only indicating the local path.

Thanks very much!
0
 
LVL 21

Accepted Solution

by:
masterpass earned 1500 total points
ID: 38788772
I did not quite get your question but once the application goes to production, you are most likely to have an address say www.xyz.com which is going to static and so the webclient should work just fine.

alternatively, you can look at fileupload control which uploads files from client machine to server : http://www.codeproject.com/Articles/1757/File-Upload-with-ASP-NET

hope this helps :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question