I have an MVC project that will display some documents to users. The files are currently stored in Azure blob storage.
Currently, the documents are retrieved from the following controller action:
public ActionResult GetDocument(string zipCode, string loanNumber, string classification, string fileName)
// get byte array from blob storage
byte doc = _docService.GetDocument(zipCode, loanNumber, classification, fileName);
string mimeType = "application/octet-stream";
return File(doc, mimeType, fileName);
Right now, when a user clicks on a link like the following:
<a target="_blank" href="http://...controller//GetDocument?zipCode=84016&loanNumber=12345678classification=document&fileName=importantfile.pdf
Then, the file downloads to their browser's downloads folder. What I would like to happen (and I thought was default behavior) is for the file to simply be displayed in the browser.
I have tried changing the mimetype and changing the return type to FileResult instead of ActionResult, both to no avail.
How can I make the file display in the browser instead of downloading?