title: SharePointWeb.GetFile method gave me "Cannot open file" SPException
body: <p>I try to open a file like that</p>
  
  <blockquote>
    <p><strong>fromServerURL = <a href="http://mysite.com/sites/CM" rel="nofollow">http://mysite.com/sites/CM</a></strong></p>
  </blockquote>
  
  <p>, it is OK.</p>
  
  <p>but it gave me the error when i pass the value like</p>
  
  <blockquote>
    <p><strong>fromServerURL = <a href="http://mySite.com/" rel="nofollow">http://mySite.com/</a></strong></p>
  </blockquote>
  
  <pre><code>SPFile file = oWebsiteFrom.GetFile(fromServerURL + "/" + fromPath + "/" + fileName);
  </code></pre>
  
  <p>I try to test it and see those.</p>
  
  <pre><code>long length = file .Length; - &gt; it gives me the correct length
  byte[] a= file .OpenBinary(); - &gt; it gave me the error
  file.Item is also null.
  </code></pre>
  
  <p>I found this link to solve the issue but it's suited for my situation when I'll not know the exact the folder structure.</p>
  
  <p><a href="http://blogs.msdn.com/b/momalek/archive/2011/02/28/reading-item-attachments-programmatically-spfile-openbinary-exception.aspx" rel="nofollow">http://blogs.msdn.com/b/momalek/archive/2011/02/28/reading-item-attachments-programmatically-spfile-openbinary-exception.aspx</a></p>