title: .net security exception
body: <p>I am using OpenFileDialog class to browse a file in window application using c#. It is giving the security exception as below.</p>
  
  <blockquote>
    <p>Request for the permission of type
    'System.Security.Permissions.FileIOPermission,
    mscorlib, Version=2.0.0.0,
    Culture=neutral,
    PublicKeyToken=b77a5c561934e089'
    failed.</p>
  </blockquote>
  
  <p>My code is</p>
  
  <pre><code>        OpenFileDialog fdlg = new OpenFileDialog();
          fdlg.Title = "C# Corner Open File Dialog";
          fdlg.InitialDirectory = @"c:\";
          fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*";
          fdlg.FilterIndex = 2;
          fdlg.RestoreDirectory = true;
          if (fdlg.ShowDialog() == DialogResult.OK)
          {
              txtpath.Text = fdlg.FileName;
          }
  </code></pre>
  
  <p>I am not getting the problem.
  please help.</p>