开发者

Navigate to local file Uri from silverlight? Exception

When i click button in SL app i want to open URI to local file in browser.When browser will navigate to this URI a "browser popup dialog" will appear to ask me if i want to "open-save-save as" this file.

I created a pure SL 4 application.Added button.In button click handler i wrote:

HtmlPage.Window.Navigate(new Uri("file://开发者_Go百科C:/Temp/Report.doc",UriKind.Absolute));

I also tried to write it as

HtmlPage.PopupWindow(new Uri("file://C:/Temp/Report.doc", UriKind.Absolute), null, null);

In either cases i have exceptions.

When i manually paste file://C:/Temp/Report.doc in InternetExplorer everything is fine, dialog appears on screen.

Is it possible to do such thing in Silverlight?


A security exception will be thrown because Silverlight can't access your local machine's C:\. If you want to open a file, you can use the OpenFileDialog. However, in Silverlight 4, you can access the filesystem if your application is out of browser.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜