Solved

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

Posted on 2011-03-03
4
488 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

706 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

19 Experts available now in Live!

Get 1:1 Help Now