Take the 2-minute tour ×

I have a Silverlight web application(4.0) with a select file open dialog, however I get this error when the user selects a file : "File operation not permitted Access to path '' is denied" When I try to debug it then I get this security exception "Dialogs must be user-initiated." Is there a way around this? Has anyone has tried doing this in Silverlight?

Here is my code so far which hasn't worked:

OpenFileDialog dlg = new OpenFileDialog
    Multiselect = false,
    Filter = "All files|*.*"
bool? userClickedOK = dlg.ShowDialog();

if (userClickedOK == true)
    textBox1.Text =  dlg.File.FullName;
share|improve this question
Please use capital letters when possible, remove greetings and in general any time wasting character. –  the_drow May 16 '11 at 8:45
please refer aspnetbymeetu.blogspot.in/2009/09/… –  Malay Patel Jul 4 '12 at 11:32

6 Answers 6

Because of security related restrictions you cannot open file dialogs in Silverlight directly. You can only open dialogs from inside an event handler like mouse click.

share|improve this answer
  1. In silverlight 4, you cannot acces the FullName property, this is the cause of exception: "File operation not permitted Access to path is denied" I trien utmost but cannot find a way to get full file path of selected file without making your application OOB.

  2. While debugging a silverlight project, if you place a break point anywhere before the dlg.ShowDialog(), in case of your code this will raise the exception: "Dialogs must be user-initiated" Simple way to avoid this exception is to place your break point after ShowDialog() line.

share|improve this answer

As far as I know you are not allowed to access user files if you don't have elevated permissions.

share|improve this answer

You can't get the full name of a file. And in all cases, why would you need it? There is no reason to know where the user stores her files.

If you want to read a file, use Stream property of the uploaded file instead.

share|improve this answer

I was having the same issue, after reading a lot about this problem that you cannot access

Instead you can use this


by doing this your exception will be removed

share|improve this answer

The error also occurs if you try to access CreationTime from a FileInfo.

share|improve this answer

Your Answer


