Solved

Uploading saved files in asp.net

Posted on 2013-01-16
4
227 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
  • 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 500 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

827 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