Forcing a Save As dialog box from an ASP.NET Web page

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 358
We can write below line of code to achieve:-
Response.Clear();  
Response.AppendHeader("content-disposition", "attachment; filename=document1.doc");
Response.ContentType = "text/plain";
Response.WriteFile(Server.MapPath("document1.doc"));
Response.Flush();
Response.End();


Above code once executed will ask a dialog box to save or open.

Comments or Responses

Login to post response