asp.net mvc - Display File From Local Drive in MVC view -
i have been trying display local pdffile d drive in view of mvc along other data.i have tried out iframe , added extensions browsers local links display of no use.i have been stuck problem since 3 days.i have tried out following code.
<iframe src="@url.content("file:///d:/pdfsfolder/" + model.filename)"></iframe>
this works fine me in ie not working in other browsers.when try open file using hyperlink works in browsers.my problem display along other data.please me out if there other way display file in view other iframe.
you have write controller & action fetch file , pass response:
public actionresult testpdf() { return file(@"d:\test.pdf", "application/pdf"); }
and in view use iframe point controller action:
<iframe src="<%= url.action("testpdf", "somecontroller") %>"></iframe>
Comments
Post a Comment