Solved

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

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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

730 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