.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Cannot prompt user with Save-As dialog

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ASP.Net

See also these links:




My client requires that I display a .pdf file in an iframe and also that I provide a download link that will prompt the user with a Save-As dialog if they choose to download the file (I am aware that the .pdf viewer has a save button.  The client requires the link).

The .pdf file itself is on a secure server so I use a HttpHandler to transmit the file.

The code shown below works fine to display the file in the iframe.

However, when the user clicks the download link, the .pdf simply opens in a new window and does not prompt the user with a save-as dialog as intended.

I am currently setting the ContentType to "application/pdf".  I have observed that when I set the ContentType to "application/octet-stream", I am always prompted with a save-as dialog (regardless of content-disposition).  However, the file the user is prompted to save is the .ashx file, not the .pdf file.

I have stepped through my code and observed that content-disposition is be

View Complete Post

More Related Resource Links

send email prompt a security dialog

i don't know why when i send email through outlook with default logging on user as a sender to receiver, it always prompt a security dialog asking me if i allow to send this email ,if click 'Yes' button,then send, click 'No' button,then fail to send and prompt a error message. how can i prevent security dialog when using visual studio 2008 and outlook 2003. 

Download a file from web and save dialog box for path

Hi I need to download a exe file from a web site. I need to prompt a savedialog box for the user to select a path to save it. This the code i have. How can i show a save dialog box here?         Private Sub downloadfile()         Dim client As New Net.WebClient         client.DownloadFile("www.mysite.com/Information/Myexe.exe", "Sr.exe")     End Sub Thanks

Design Pattern for Checkbox User Dialog C#

Hi Is there a recommended design pattern for a user dialog which has an array of checkboxes? The most rudimentary design seems to be to use an integer as a bitwise paramater which can be passed to and from the dialog based the [checked/unchecked] state of the checkbox(es). Based on approx 3hrs googling the most likely design pattern seems to be "Decorator", but I'm yet to find a C# windows form example. Is "Decorator" the best pattern? Do most people just stick with bitwise manipulation of an integer?  Any examples or url links? Best regards Doug

Confirmation prompt when click on "save" button?

Currently I am working on SharePoint 2010 project that my customer want something like confirmation prompt, (e.g. upon click on “save” button, system prompts “are you sure you want to save?”) for all following 8 area: ·         Document Repository (meta-data) ·         Calendaring ·         News ·         Task List ·         Quick Links ·         Blogs ·         Wiki ·         Forums   Is this possible?  Has anyone done this or something similar?  Can anyone point me to some examples or best practices when doing this? Thanks Believing is Seeing

VS , Where Create User Wizard Save User and Pass and info

Hi , First Sorry For My Bad English :DAnd Second:I Have Question : Can I Edit Create User Wizard To Save Info To My Project  Sql ? And Where Normal Create User Wizard Save Info Of Register ? TanX !! :D !

Refresh Parent Page List after Edit Item Modal Dialog Save/Close

I am calling the Edit Item URL (EditForm.aspx?ID=x&IsDlg=1) via javascript code to bring up the Edit Item Modal Dialog. This works fine and dandy. But what callbackfunction should I invoke after the Save so that the parent list is refreshed? Is there a better way to do it than call reload on the entire parent frame? It almost looks like there should be a way to refresh just the list. Any help appreciated. Thanks, Jake.

How to show a message box on an invalid filename entered while saving a file using save file dialog

Hi all i have written a code to display a message box if invalid characters are entered while saving the file but my message box is not displaying. Actually i will have a save file dialog option to save a file if the filename starts or consists of the following    \\/:*?<>|"  I would like to display a message box as invalid or illegalcharacters in file My code is as follows    Stream myStream;                          SaveFileDialog saveFileDialog1 = new SaveFileDialog();                            saveFileDialog1.InitialDirectory = @"C:\";                          saveFileDialog1.DefaultExt = "txt";                          saveFileDialog1.Filter = "(*.txt)|*.txt";                          saveFileDialog1.FilterIndex = 2;                          saveFileDialog1.RestoreDirectory = true;                            if (saveFileDialog1.ShowDialog() == DialogR

Report Parameter type for a list of Employees to prompt like AJAX Textbox intellisence when the user


Hi All,

I have around 300 employees report to run for a specific employee, I cannot have a Dropdown as it would be too long for the report user to choose from. Is it possible in SSRS 2008 to have a text box that would provide intellisence like AJAX textbox and provides user with Employee name to choose from database or is there any other better way to select the right mployee name to run this kind of report. being a newbie to SSRS I am unable to go furthur on this. All help is great help. Thanks in advance for responding.

By pass the prompt - Do you want to open or save this file?


Is there any way that I can avoid or bypass the following prompt: Do you want to open or save this file?

I am using a data view webpart where I have hyper-linked a column with  an infopath file. So when ever I click on the hyperlink, a window prompts with the mentioned text.

Any help in this regard will be appreciated!

Save a page only when user changes any data



 I my application in need to save web page data only when user changes any loaded data?If not should promt a message

No data to save ! how to do it.Please help me

How to save a multiple user control to a few single record text?

I have a list with people pecker control that admits multiple users.
I like to have another list with one record for each user in the control that loaded before.
Is there any way in InfoPath or in a workflow to use something like FOR EACH to take one by one user in a control and write/update records after that?
Thank in advance

save file dialog box


i am developing a web application i want to sava a file using sava file dialog box pls give me code insted of links

How to disable the SAVE dialog?



When I clicked on the Close button on the top menu, it asked me


"Do you want to save the changes in this form?" 


How can I disable it ?   I dont want my user to save this form


Thank you

SSIS package not able to save encypted user sensitive password


i have an ftp fetch package in bus development studio 2008.  it runs from that interface.  i imported it into Integration Services, set the password along with the EncryptSensitiveWithPassword and if i manually enter password each time i can run successfully from sql integration services.  but i cannot schedule as a job because the password won't stick.

any help out there would be great.

asp.net c# save confirmation from user



I have a form in which user enter the details ......after the details have been enter by the user and on cliking on the save button i want to display pop-up saying that " Are you sure you want to save and if the user press yes then only user details should save in database else the user should return to the page.....how to do that please help in this with the proper code.....

workflow triggered during upload but after the user enters values in the properties dialog


1) When "Start this workflow when a new item is created" option is selected the workflow gets triggered as soon as the file is uploaded and even before the 'edit properties' dialog is displayed.  I want the workflow to be triggered after the properties are entered by the user on upload.


2) Selecting "Start this workflow when an item is changed." option also does not trigger the workflow during upload.  This triggers only when the user explicitly selects 'Edit Properties' dialog.


So my question is, how to get the workflow triggered during upload but after the user enters values in the prop

Header user control appearing on all dialog windows (not desired)

I added a user control in the master page for a particular site definition.  

All good however the problem occurs when I open the dialog to add new documents for example.   The user control appears at the top of this dialog box as well.

This same top header is visible on all open dialog boxes at the top which obviously what i was going for.

How can I have the user header control only appear on main pages? (and not dialog windows?)

hmmm ideas?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend