Programmatically Force a Save As Dialog Box


Is it possible to force the file download box to appear through ASP? I want to create a file on the fly with the response.write method to fill its contents. The file should downloaded on the user’s machine through the dialog box with a user-defined filename as the default.


Yes. Before you send your first response.write, change the content type to some weird type that the browser will not recognize. It will then prompt the user to download.

Response.ContentType = "application/xyzblah"Response.write "The contents blah blah blah"

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: