asp.net - Iframe shows ActionMethod name while loading PDF file in ASP MVC -


i using iframe tag in order call actionmethod returns fileresult display pdf file. issue after loads pdf document instead of showing pdf file name, shows actionmethod name on top of pdf file name in chrome.

razor code:

<iframe src="@url.action("getagreementtoreview", "employee")" style="zoom: 0.60; -ms-zoom: 1; width: 100%;" width="99.6%" height="420" frameborder="0" id="agreementpdf"></iframe> 

cs code:

public actionresult getagreementtoreview() {   response.addheader("content-disposition", "inline; filename=master-agreement.pdf");       return file("~/content/master-agreement.pdf", "application/pdf"); } 

image: can see in screenshot, shows 'getagreementtoreview' i.e. actionmethod name instead of 'master-agreement.pdf'.

enter image description here

does know how fix issue? thanks.

sanjeev

please try code :

return file("~/content/master-agreement.pdf", "application/pdf", "filename.pdf"); 

other helper link : stream file using asp.net mvc filecontentresult in browser name?


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -