title: c# system.net.FileWebRequest Access denied error
body: <p>I want to get a file size  over network via System.Net.FileWebRequest.  For example: \IP\c$\sampleFile.txt</p>
  
  <p>I supply the credentials for accessing file via passing it to FilewebRequest's credentials
  but the code below returns an access to path denied error.  What is worng here?
  How can I access files over network? (I have crediantals to access file)</p>
  
  <pre><code> System.Net.FileWebRequest request = (System.Net.FileWebRequest)
   System.Net.FileWebRequest.Create(url);
   request.PreAuthenticate = true;
   request.Credentials = new NetworkCredential(_clientUser,_clientPass);
   FileWebResponse response = (System.Net.FileWebResponse) request.GetResponse();
  
   // gets the size of the file in bytes    
   Int64 iSize = response.ContentLength;
   response.Close();
  </code></pre>