开发者

Open a file in the browser from Silverlight

开发者 https://www.devze.com 2023-03-07 06:40 出处:网络
I have a Button (or a hyperlinkbutton) in Silverlight. I want to open a file on a server share when this butto in clicked. With other words I want a new Browser Tab or Window to open showing the reque

I have a Button (or a hyperlinkbutton) in Silverlight. I want to open a file on a server share when this butto in clicked. With other words I want a new Browser Tab or Window to open showing the requested file, just like I enter the URL in the browsers addressbar:

file://C:\myfile.txt

I tried in the OnClick Method the following:

System.Windows.Browser.HtmlPage.Window.Navigate(new Uri(@"file://C:\myfile.txt"),"_blank");

it throws an Exception (Access denied). When I do the same with an http: page it works:

Sys开发者_Python百科tem.Windows.Browser.HtmlPage.Window.Navigate(new Uri(@"http://www.somedomain.com"),"_blank");

How can I achive the same with a file. Security can not be an issue, I have full access to that file. And please don't tell me that this is not possible... would mean we have to go back to PHP.


Silverlight runs on the client side and in by default in LOW trusted mode which dont allow application to access local file system. For the purpose, u can try giving full trust to the silverlight application.


Firefox does not allow external URLs to link to a local resource anymore :(

0

精彩评论

暂无评论...
验证码 换一张
取 消