title: How to read the contents of a text file on a user's computer within asp.net web app?
body: <p>using vb.net, .net 4.0..</p>
  
  <p>I'm trying to read the contents of a text file on a user's computer from my IIS deployed web app.
  Now, in local debug mode, I have no issue reading the contents of my computer, it's just that when I publish it, I can no longer obtain a value.</p>
  
  <p>here's what I have, </p>
  
  <p>Here's the function :</p>
  
  <pre><code>Public Function GetFileContents(ByVal FullPath As String, _
     Optional ByRef ErrInfo As String = "") As String
  
      Dim strContents As String
      Dim objReader As StreamReader
      Try
  
          objReader = New StreamReader(FullPath)
          strContents = objReader.ReadToEnd()
          objReader.Close()
          Return strContents
      Catch Ex As Exception
          ErrInfo = Ex.Message
      End Try
  End Function
  </code></pre>
  
  <p>Calling the function and returning the contents:</p>
  
  <pre><code>sContents = GetFileContents("C:\Location.txt", String.Empty)
  </code></pre>
  
  <p>In my Site.Master pageload, assigning the variable with data:</p>
  
  <pre><code>UserInfo.Text = Global_asax.sContents
  </code></pre>
  
  <p>Again, locally, all fine and dandy...running over the web server. No luck. </p>
  
  <p>I am trying to obtain information pertaining to this user w/o having them to provide the information. Reading from a text file seemed like a good idea.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks.</p>