Forcing Save target as... dialog

G

Guest

Hi and thanks in advanced for you help. I am working on a file-distribution
asp.net application. Users click on a custom grid column to download files
stored on a SQL DB. The client does not want to open the file in the browser,
so how can I either:
1. Display the Save Target as dialog box to download the a file when the
file is in memory using the WebFileResponse class.
2. or simulate the right click (Save Target) from a hyperlink to a physical
file.

Thank you.
 
S

Steve C. Orr [MVP, MCSD]

The user and browser are ultimately in charge of what happens to the file on
the client side. You have very limited control from the server side unless
you run some thick client side code such as an ActiveX control.

One possible solution:
If you zip the file, it could not be opened directly.
Well the zip file could be opened directly, but it would be a separate step
if they wanted to open the file inside the zip file, which would already be
on their hard drive by that point.
Not sure if this might meet your requirements or not.
 
D

darrel

1. Display the Save Target as dialog box to download the a file when the
file is in memory using the WebFileResponse class.

WebFileResponse?

I'm not familiar with that. The basic concept, though, is that you need to
stream the file to the browser as opposed to letting the end-user click on
the link itself.
2. or simulate the right click (Save Target) from a hyperlink to a physical
file.

That's a browser function that you can't control from the server.

Personally, I find the best solution is user-education. Put a disclaimer at
the top of the page:

"To download these files, right-click the link and choose 'save as'"

-Darrel
 
E

enceladus311

Steve said:
The user and browser are ultimately in charge of what happens to the file on
the client side. You have very limited control from the server side unless
you run some thick client side code such as an ActiveX control.

One possible solution:
If you zip the file, it could not be opened directly.
Well the zip file could be opened directly, but it would be a separate step
if they wanted to open the file inside the zip file, which would already be
on their hard drive by that point.
Not sure if this might meet your requirements or not.

What's wrong with the HTTP Content-Disposition: Attachment header?
 
G

Guest

Thank you all for the responses. The client has agreed to educate the users
and to use an encryption mechanism which will force users to save the file.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top