473,396 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Forcing Save target as... dialog

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.
Nov 19 '05 #1
4 3378
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.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net

"randmCP" <ra*****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
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.

Nov 19 '05 #2
> 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
Nov 19 '05 #3

Steve C. Orr [MVP, MCSD] wrote:
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?
--
Sean

Nov 19 '05 #4
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.

"randmCP" wrote:
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.

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: cathywigzell | last post by:
I have a web page which allows a user to download a file directly to their computer, using IE. I present a file name in a table and the user can then right click on the file name to get a popup...
2
by: Greg | last post by:
looking for an easy way for users to browse for a file on their local drive, and then have access automatically make a copy of that file (files will most likely be images) and save it under a new...
0
by: Matthew Workman | last post by:
Hello all, Does anyone know if you can force the acceptance of a save-as print dialog box programmatically? Specifically, I am opening a document locally, creating a PrintDocument, changing the...
4
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
0
by: Mike P | last post by:
Hi, I am trying to implement on an ASP.NET page that when a user clicks on a file link, it forces the Save/Open box in the browser. I have managed to do this (with a little help from this...
4
by: teeBull | last post by:
Hi all, We'd like to take advantage of code we already have for transforming XML into HTML (using XSLT) for our users to save the HTML as an MS Word document locally. I've dug around and found...
3
by: jodleren | last post by:
Hi! I talked about this some time ago somewhere else, now I am working with this again... I want to offer the user to save/open a file, instead of the browser opening it by itself (as e.g. a...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
3
by: evenlater | last post by:
I have an Access application on a terminal server. Sometimes my users need to export reports to pdf, rtf or xls files and save them to their own client device hard drives. They can do that right...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.