views:

146

answers:

2

I'm trying to open local file from Silverlight. I try Window.Navigate("c:\test.pdf", "_blank") and invoking JavaScript like this:

window.open("c:\test.pdf", "_blank")

Both give "Access is denied".

However it works in plain HTML when I do

<input type="button" value="test" 
       onclick="window.open('c:\test.pdf', '_blank')" />

Is it Silverlight security restriction? Can I open a local file in a browser from Silverlight application?

The reason behind this is that users store local paths and want to open those files from the app.

+3  A: 

Silverlight is heavily sandboxed. As it is a web technology, you can probably imagine the potential security implications of giving it access to the file system.

ZombieSheep
I actually can't imaging any implications. JavaScript is also a web technology, as well as <a href="file:///c:\test.pdf"> but they do work.
queen3
A: 

In Silverlight 4, you have access in the local file system, but to the user's "My" folders only. See http://timheuer.com/blog/archive/2009/11/18/whats-new-in-silverlight-4-complete-guide-new-features.aspx#localfiles

Adam Roderick