Live Chat Icon For mobile
Live Chat Icon

How can I force a Save As dialog box from an ASP.NET Web page.

Platform: ASP.NET| Category: Miscellaneous

VB.NET


Response.Clear()
Response.AppendHeader('content-disposition', 'attachment; filename=document1.doc')
Response.ContentType = 'text/plain'
Response.WriteFile(Server.MapPath('document1.doc'))
Response.Flush()
Response.End()

C#


Response.Clear();
Response.AppendHeader('content-disposition', 'attachment; filename=document1.doc');
Response.ContentType = 'text/plain';
Response.WriteFile(Server.MapPath('document1.doc'));
Response.Flush();
Response.End();

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.