asp.net mvc 2 - How to return image from controller without setting Content-Disposition tag? -
so i'm using mvc 2 serve images controller action. general wisdom (1, 2, 3) seems to use 1 of fileresult
types (filestreamresult
, filecontentresult
or `filecontentresult').
all 3 concrete fileresult
's, however, set content-disposition
response header attachment; filename{yourfilenamehere}=utf-8
. net result if user views image directly, rather embedded in html, browser present save dialog, rather displaying image. prefer image display in browser.
i guess makes question: using mvc 2 appropriate way return image result image not marked download?
the mvc framework uses fileresult.filedownloadname property determine whether send content inline or attachment. if you're instantiating fileresult-derived type directly, don't set filedownloadname property. alternatively, if you're using controller.file factory methods, call overload doesn't take filedownloadname argument (or pass in null argument).
Comments
Post a Comment