title: How to read a text file with a web service
body: <p>I want to create a web service that takes a text file as parameter and returns the content of that file.</p>
  
  <p>This web service will then be used by a C# client.</p>
  
  <p>This is what I have so far (webservice):</p>
  
  <pre><code>[WebMethod]    
  public String txtFile(String filename)
  {
     StreamReader sr = File.OpenText(filename);   
     {
        String line = sr.ReadToEnd();
        return line;            
     } 
  }
  </code></pre>
  
  <p>and(client):</p>
  
  <pre><code>WebService ws = new WebService();
  ws.txtFile("textfile.txt");
  </code></pre>
  
  <p>When I run the client I get UnauthorizedAccessException.</p>