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. 4 3403
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*****@discus sions.microsoft .com> wrote in message
news:41******** *************** ***********@mic rosoft.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.
> 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
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
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 menu with the
option 'Save Target As...'. Selecting that option results in the Save
As dialog.
However, if the filename has a reconginsed extension, e.g. .doc, then
the Save As dialog adds another extension, so the file name in the Save
As dialog...
|
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 name
(somehow relating it to the PK of the main table) in a directory on
the server where the DB is stored...
i realize that might not be the best wording of what im trying to do,
so ill try explaining it a lil differently. each record created...
|
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 printer name and then printing it to
a file. From there, a save-as box is asking the user to confirm the
location but I want it to automatically accept it. Any ideas? I'm stuck in
the mudd at the moment. :(
Much thanks in advance
|
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"
Hyperlink1.NavigateUrl = "MyReport.csv"
When the user clicks the HyperLink I would always like to
|
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 newsgroup) but now when the user clicks
open, the dialog pops up again and only after clicking open again, the file
opens in whatever application is defined for that mime type. Does anyone
know why the dialog is being displayed twice? Why will the file...
| |
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 the following code to
include in the code behind:
Response.ContentType = "application/vnd.ms-word"
Response.AddHeader("Content-Disposition",
"inline;filename=someFile.doc")
|
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 jpeg picture would).
Looking into the advices I got at the time, I came up with this:
<?php
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - How do I prompt a "Save As" dialog for an
accepted mime type?
-----------------------------------------------------------------------
It is not possible with client-side JavaScript.
Some browsers accept the Content-Disposition header, but this
must be added by the server. Taking the form:-
` Content-Disposition: attachment; filename=filename.ext `
|
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 now the way I have this set up, but it's
confusing and slow. When they browse for a place to save the reports,
they see all of the drives on the terminal server as well as their own
client drives. So they're likely to want to choose "My...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |