Sometimes we would like to start attachment downloading instead showing in browser, for example for images (like PNG, JPG, GIF, etc). But usually browser displays content instead to prompt for saving. To fix this issue we just need to add one line of the code:
Response.AddHeader("Content-disposition", "attachment; filename=\"photo.png\"");
It adds header to the response and browser will prompt client for file saving.
Hope this helps.
No comments:
Post a Comment
Note: only a member of this blog may post a comment.