如何从asp.net MVC app中的链接打开文件 [英] How to open a file from a link in asp.net MVC app

查看:176
本文介绍了如何从asp.net MVC app中的链接打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我从MVC.net(MVC 5)应用程序打开文件时遇到了问题。此应用程序使用户能够将文件上载到共享磁盘(doc,pdf,jpg),然后将其显示为应用程序中的链接(link expample,file://computer_name/shared_folder/file_name.wtf)。我知道chrome默认情况下不允许这样(xss脚本攻击),但这在firefox或IE中也不起作用(我没有得到任何错误消息或工作)只打开一个空白页面。如果文件位于服务器上的applicatoin文件夹中,则evrything按预期工作(word文件在单词等中打开...)共享文件夹在IIS中作为Web应用程序映射。



有没有人有类似的问题或者知道如何更好地做这类事情?



PS我无法改变过程或放入文件一个数据库,它们必须驻留在共享磁盘上,并且必须在相应的应用程序中打开(而不是下载)。



谢谢。

B

Hello I've been having problems with opening files from an MVC.net (MVC 5) application. This application enables users to upload files to a shared disk (doc, pdf, jpg), wich in turn are displayed as a link in the application (link expample, file://computer_name/shared_folder/file_name.wtf). I understand that chrome does not allow this by default (xss script attacks), but this does not work in firefox or IE as well (i get no error messages or wornings) only a blank page opens. If the file is in the applicatoin folder on the server, evrything works as expected (word file opens in word etc...) The shared folder is mapped in the IIS as a web application.

Has anyone had any similar problems or knows how to do this kind of thing better?

PS I cannot change the process or put the files in a database, they must reside on a shared disk, and they have to open in the appropriate application (not download).

Thank you.
B

推荐答案

尝试右键单击链接并单击另存为?你得到了什么?它是否将所需文件保存到您的桌面或仍然空白?
Try right click on the link and click save as? what do you get? does it save the required file to your desk or still blank?


确定无论如何我都能正常工作(如果我复制链接并将其粘贴到新窗口,链接工作,文件打开)。我想我必须弄明白如何在chrome或firefox中打开file://链接类型。有什么建议?在evry计算机上禁用在chrome或firefox中阻止此功能的功能是不可能的,因为这是一个拥有100多个用户的系统,所以这个解决方案是不可接受的。
Ok I got it working, well the correct links anyway (if I copy the link and paste it to a new window, the link works and the file opens). I guess I have to figure it out how to open "file://" link type in chrome or in firefox. Any suggestions? Disableing the feature that blocks this in chrome or firefox on evry computer is out of the question, becosue this is a system with 100+ users, so this solution is not acceptable.


这篇关于如何从asp.net MVC app中的链接打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆