2008年8月8日

[ASP.Net] Download File & Open File on browser

There are times you need uses to open files on browser rather than to download and save them to the disk. To do this we need to specify HTTP header(Content-Deposition)

To enforce download dialog,

Response.AddHeader("Content-Disposition", "attachment; filename=" + fn);
To open on browser,
Response.AddHeader("Content-Disposition", "inline; filename=" + fn);


 

沒有留言:

About Me