title: How do I access a file outside of my xap file in Silverlight
body: <p>I'm having some troubles accessing a video file that sits right outside of my xap file. Is it possible to access this file using <code>Application.GetResourceStream()</code>?</p>
  
  <p>If I put <code>test.wmv</code> in the root of my xap file then the following works as expected:</p>
  
  <pre><code>                        Uri uri = new Uri("test.wmv", UriKind.Relative);
                          h.Resource.Stream = Application.GetResourceStream(uri).Stream; 
  </code></pre>
  
  <p>However, If I put <code>test.wmv</code> outside of my xap file, but in the same directory then I'd expect the following to work:</p>
  
  <pre><code>                    Uri uri = new Uri("/../test.wmv", UriKind.Relative);
                      h.Resource.Stream = Application.GetResourceStream(uri).Stream; 
  </code></pre>
  
  <p>But it doesn't and I end up catching the error: </p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object</p>
  </blockquote>
  
  <p>I presume that means that it can't access or find <code>test.wmv</code></p>
  
  <p>Can anyone help me with this?</p>
  
  <p>Maybe it isn't possible to use <code>GetResourceStream()</code> for this because it expects a relative URI with respect to the xap file. In that case, what other method can I use?</p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/cc190632%28v=vs.95%29.aspx" rel="nofollow">MSDN</a></p>
  
  <p><a href="http://forums.silverlight.net/forums/p/123145/304461.aspx" rel="nofollow">Silverlight Forums</a></p>