Save a file locally for ASP.net 2

G

Guest

Hi,
I would like to save a file locally (on the client computer) in an ASP.net
application.
It is like the server would return some data that the user can save to a
file on his local PC.
The ASP page has a text field to type in the file path directly and a
"Browse..." button, that shall display a "Save as..." dialog.
I tried with the FileUpload control, but this does not work, since I do not
want to upload an existing file, but I want to save a new file locally.
Any idea how this can be done?

Thanks and best regards, Matt
 
G

Guest

im not sure you'd be able to to be honest (although I could be wrong). it
would be waay to much of a security risk.

the only way I can think of is generate the file on the server with the name
entered, stick it in a temporary directory unique to the session, and then
fire a download link, to prompt the user to download and open|save the file.

hth
 
M

Marina Levit [MVP]

You can't do that, this would be a major security hole if a web page could
automatically save a page to a given location on the client hard drive.

You will have to stream out the file, and the user will be prompted with a
save dialog - and have to save that way, which is the usual manner of
downloading files.
 
G

Guest

You can't save a file on the client computer from the server.

You can let the user download a file, as musosdev suggested.

You can create an ActiveX control or Java applet to put on the web page,
that runs on the client and saves a file. This of course requires that
the user accepts that the control is started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top