Solved

How do I copy a file from a web server to the users local machine

Posted on 2011-03-03
4
490 Views
Last Modified: 2012-05-11
I am attempting to copy a selected file from the web server to a user's desktop on their local machine using the Environment variables .MachineName and .SpecialFolder.Desktop. The application works fine when running in Visual Web Developer on my local machine but when I upload the application to the web server and run it from a browser on my local machine it copies the files to my desktop on the server. The .MachineName environment variable shows the web server name rather than my local machine name.
0
Comment
Question by:Duder258
  • 2
4 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 35031341
Yes, there is no way you can copy files to a users desktop without using a download dialog that is part of a file download process that you initiate with the user opting to begin the process.

You have no access whatsoever to a users file system. You may read/write/delete N+1 files to the web server you run on but that's it.
0
 

Author Comment

by:Duder258
ID: 35031418
Actually that is what I would like to accomplish here. As the application works now, the user presses a "Download" button next to the file they want downloaded and I am wantinf it placed on their desktop. You mention a download dialog that is part of a download process in your comment. Can you expand upon what I need to do and or use to make that happen?

Thanks
0
 
LVL 33

Accepted Solution

by:
raterus earned 250 total points
ID: 35062168
The only easy way this is going to work is if your user and server are on the same domain, and the user's computer is not firewalled.

Then, you can copy to the user's computer by creating a string like so

\\(User's IP Address\c$\Files\test.txt

e.g.
\\192.168.1.123\c$\Fles\test.txt

With that said, this will get very tricky since each user workstation will have to be configured properly.  It's probably much easier to just give them a link to download/save to their computer.  You can use Response.WriteFile(...) to do that.
0
 

Author Closing Comment

by:Duder258
ID: 35114041
Thanks. This got me going and now it works.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

815 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now