title: Acess Denied. Reading and writing the file. Grant reading permission
body: <p>After installation the application gives error </p>
  
  <blockquote>
    <p>access denied to the file <code>PathName\\BLsms.ocx</code></p>
  </blockquote>
  
  <p>Here PatheName is complete path.</p>
  
  <p>Advance installer is used to create the installer. </p>
  
  <p>Then application is installed in <code>C Drive</code>.</p>
  
  <p>How can I make these files read and writable?</p>
  
  <p>I am using this code.</p>
  
  <pre><code>try
  {
  
      this.brlmfc = new BinaryReader(new FileStream("BLsms.ocx", FileMode.Open, FileAccess.ReadWrite,FileShare.Read));
      this.brocx = new BinaryReader(new FileStream("BLrpi.lfc", FileMode.Open,FileAccess.ReadWrite));
  
      this.brlmc = new BinaryReader(new FileStream("rpcgh.lfc", FileMode.Open,FileAccess.ReadWrite));
      this.passkey1 = this.brlmfc.ReadString();
      this.passkey2 = this.brocx.ReadString();
  
      this.passkey3 = this.brlmc.ReadString();
  
  }
  catch (Exception e13)
  {
      MessageBox.Show(e13.Message);
      i = 0;
  }
  </code></pre>
  
  <p>I have also tried the following code in Form Load method.</p>
  
  <pre><code>FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.AllAccess, Application.StartupPath+"\\BLsms.ocx");
  f2.AddPathList( FileIOPermissionAccess.Read, Application.StartupPath+"\\BLrpi.lfc");
  f2.AddPathList( FileIOPermissionAccess.Read, Application.StartupPath+"\\Brpcgh.lfc");
  f2.Demand();
  </code></pre>