MVC 5 asp .net中的URL

时间:2016-08-10 09:32:55

标签: c# asp.net asp.net-mvc asp.net-mvc-5 pdf.js

我正在尝试使用PDF.js在MVC 5应用程序上显示pdf。

问题是它是通过URL

获取文件名
localhost:32557/Viewer/PDFViewer?filename=thepdffile.pdf

问题是我是根据查看器的类型从另一种方法重定向到PDFViewer

case 5:
   return RedirectToAction("PDFViewer?file=/source/compressed.tracemonkey-pldi-09.pdf", new { id = viewerId});

我得到的网址是

localhost:32557/Viewer/PDFViewer%3ffile%3d/source/compressed.tracemonkey-pldi-09.pdf

此外,我收到此网址的错误

A potentially dangerous Request.Path value was detected from the client (?).

你能帮帮我吗

1 个答案:

答案 0 :(得分:0)

最后,我在@ bzlm评论的帮助下解决了使用cordova-plugin-device-orientation而不是Redirect的问题。

所以早些时候我正在使用

RedirectToAction

而不是我可以使用

return RedirectToAction("PDFViewer?file=/source/compressed.tracemonkey-pldi-09.pdf", new { id = viewerId})

return Redirect(baseUrl+"Viewer/PDFViewer?file=/source/compressed.tracemonkey-pldi-09.pdf") 是一个包含baseUrl

的字符串变量