Reputation: 12286
I have an MVC action that pulls an image from a database and sends it in the response via the File(byte[], string) method. When I navigate to the action in my browser, it downloads the file rather than display it in the browser.
I'm setting the file and setting the content type to "image/jpeg". Is there another header that needs to be set in order to get it to do what I want it to do?
Upvotes: 2
Views: 258
Reputation: 12286
Ok, mystery solved.
Controller.File() has an overload that takes no filename; just data and content-type. Using that overload causes the content-disposition to be set correctly. In retrospect, I guess that makes a lot of sense.
Upvotes: 2