1

I have web application(asp.net).is there any way to show a 'SAVE AS DIALOG BOX'(in browser) when user clicks the download button.i have tried several codes but i didn't get expected result.all are download the file normally to downloads(default download path of browser).is it possible to open save as dialog box in web browser

jyothis
  • 84
  • 1
  • 3
  • 8
  • 3
    That is completely impossible. – SLaks Nov 12 '14 at 03:58
  • The browser user interface belongs to the user, not to the web developer. What if the user has told the browser _not_ to display a Save As dialog? – John Saunders Nov 12 '14 at 04:07
  • The concept isn't impossible - obviously you can't open the system's file dialogue, there may be a way to tell the browser that a file is ready for downloading. This would bring up the browser's file dialogue. – bgmCoder Jun 06 '17 at 17:07

2 Answers2

2

Already answered: [Save dialog box to download file, Saving file from ASP.NET server to the client

Community
  • 1
  • 1
Nader Khazai
  • 185
  • 6
  • hi nader ,i have tried this code.i got an exception on response.Flush(); "[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}" and the file is downloaded normally without open save as dialog box – jyothis Nov 12 '14 at 04:49
0

Probably you're looking for download a file in asp.net? Please see sample below.

Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=MyFile.pdf");
Response.TransmitFile(Server.MapPath("~/Files/MyFile.pdf"));
Response.End();
.htm, .html     Response.ContentType = "text/HTML";
.txt    Response.ContentType = "text/plain";
.doc, .rtf, .docx    Response.ContentType = "Application/msword";
.xls, .xlsx    Response.ContentType = "Application/x-msexcel";
.jpg, .jpeg    Response.ContentType = "image/jpeg";
.gif    Response.ContentType =  "image/GIF";
.pdf    Response.ContentType = "application/pdf";

How to download a file in ASP.Net

Chris
  • 599
  • 7
  • 23
  • Not sure if the post would be even valid comment in current state. Please provide summary of the link inline if you believe article shows answer to the question. – Alexei Levenkov Nov 12 '14 at 04:15
  • I will provide the details.. I will edit my post later. Have to take a quick lunch first ;)... Thanks for reminding me :) – Chris Nov 12 '14 at 04:41