在浏览器窗口中打开文件 [英] Open file in browser window

查看:129
本文介绍了在浏览器窗口中打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在Silverlight页面中编写了以下代码,它运行成功.

字符串filepath ="http://ServerName/XYZ_FolderName/ABC_FolderName/" +"abc.pdf";

System.Windows.Browser.HtmlPage.Window.Navigate(新Uri(文件路径),"_ blank",工具栏=否,位置=否,状态=否,菜单栏=否,可调整大小=是");

但是,如果我将文件路径指定为波纹管,并将其存储在本地磁盘中,那么(不在上述服务器上)

filepath ="E:/myfile.pdf"

其显示错误-InvalidOperationException被拒绝,访问被拒绝.

注意:我拥有我所有驱动器的全部权利.

Hi,

I have write code below in silverlight page,its run successfully.

string filepath="http://ServerName/XYZ_FolderName/ABC_FolderName/" + "abc.pdf";

System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(filepath), "_blank", "toolbar=no,location=no,status=no,menubar=no,resizable=yes");

But if i have given filepath as a bellow, which are stored in local disc,(not on server like above)

filepath="E:/myfile.pdf"

its showing an error-InvalidOperationException is Denied,Access is denied.

Note: I have full rights of my all drives.

推荐答案

在Silverlight中,您只能使用OpenFileDialog类 [
In Silverlight you can only access local files through a user initiated action (event) using the OpenFileDialog class[^].


您应该只在服务器的主目录下使用路径,最好使用相对路径
you should only use path under your home dir in the server and it is better to use relative path


这篇关于在浏览器窗口中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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