Reputation: 3413
My application in asp.net using vb.net scripting generates a file with system processing outputs, responding to a button click. This file is stored in a folder in the server, and I would like to start a download of this file automatically for the user. How can I do it?
Upvotes: 1
Views: 3100
Reputation: 1459
The following code will show the standard "Save As.." dialog to the user. You'll want to change the contenttype to the mime for your file.
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition","attachment; filename=yourfile.jpg");
Response.TransmitFile( Server.MapPath("~/yourfile.jpg") );
Response.End();
Upvotes: 2