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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -