用户生成的指向网络共享上托管的文件的超链接
我的最终目标是允许用户从对话框中选择文件,就像上传文件一样。将从文件的路径生成超链接,而不是将文件保存到服务器。然后,该超链接将在我们的 Intranet 页面上使用,以便打开位于我们网络共享上的文件。有什么实际的方法可以实现这一点吗?
我已经尝试过 HTML 文件类型插入和 .Net 的 FileUpload 控件,但两者都不起作用,因为出于安全原因,文件的完整路径永远无法访问。
内联网站点是用VB.Net 构建的。
My ultimate goal is to allow users to select a file from a dialog as if they are uploading a file. Instead of file being saved to the server, a hyperlink will be generated from the file's path. This hyperlink will then be used on our intranet page in order to open the file located on our network share. Is there any practical way to accomplish this?
I have tried both an HTML file type insert and .Net's FileUpload Control but neither will work since for security reasons the full path of the file is never accessible.
The intranet site is built in VB.Net.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法通过常规网页执行此操作,因为访问文件路径的网站将严重违反安全规定。您可以做的一件事是在页面上进行控件,服务器在其中通过浏览网络共享创建文件树。然后用户将从服务器生成的树中选择文件路径。
You would not be able to do this through a regular web page, since a web site gaining access to a file's path would be a gross security violation. One thing you could do is have a control on your page where the server creates a file tree from browsing the network share. Then the user would select the file path from this server-generated tree.
假设您的网络共享驱动器是 S: 驱动器,
如果您使用普通的旧 file:// 样式 URI,链接将自动打开共享驱动器上的文件。
即 file://s:\techfiles\myfile.txt
为了将该文件放在共享驱动器上,您必须在共享驱动器服务器上运行该 Web 应用程序(或有权访问它),因此只需将该文件保存到共享服务器,然后生成路径。事实上,webapp 服务器在存储文件之前会暂时保留该文件,这不会太困扰您......
suppose your network share drive is the S: drive
if you use plain old file:// style URI's the links will auto open to your files on the share drive.
i.e. file://s:\techfiles\myfile.txt
in order to put the file on the share drive, you must be running that webapp on the share drive server(or have access to it), so just save that file off to the share server, then generate the path. The fact that the webapp server temporarily holds on to the file before storing it shouldn't bother you too much...