Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am assuming you are trying to access a file in the local filesystem.</p> <p>If so, you cannot access files like that. Silverlight does not have the access priveleges u expect. If you want to add a file to your Silverlight Application at runtime. You will need to have Silverlight 4, running Out of the Browser with Elevated priveleges. There are certain limitations to this too. You can only access files in Special Folders like My Documents, Pictures, Music etc. For more info about access files this way. You can look at <a href="http://channel9.msdn.com/learn/courses/Silverlight4/Overview/Overview/Moving-Beyond-the-Browser--Elevated-Trust-Applications/" rel="nofollow noreferrer">John's tutorials</a> on Silverlight 4 elevated priveleges in Channel 9 MSDN.</p> <p>I would doubt your FileInfo usage too. Here is a sample code to get file data using a simple drag and drop feature.</p> <pre><code>private void list_Drop(object sender, DragEventArgs e) { FileInfo[] files = (FileInfo[])e.Data.GetData(DataFormats.FileDrop); for(int i=0;i&lt;files.Length;i++) textblock.Text += files[i].Name; } </code></pre> <p>You can get the properties of the file such as "Name". You wil not hit any access denied errors. You cannot access properties like "DirectoryName", "FullName" etc. The reason being they are declared as SecurityCritical properties for Security reasons. The advantage of elevated permissions is that you can get to local file system (special folders) to access the FullName and DirectoryName properties without any exceptions.</p> <p>Hope this helps</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload