title: Sending .txt file to client c#
body: <p>I'm struggling with the ability to take a file from the server and allow a user to download it. On my machine, I was just opening it but since it has gone to production this doesn't seem to be a working solution. </p>
  
  <pre><code>public HttpResponseMessage Post([FromBody]string[] info)
  {
      HttpResponseMessage resp = new HttpResponseMessage();
      string html = info[0];
      _file += info[2] + @"\media\";
  
      try
      {                
          using (StreamWriter sw = File.CreateText(_file))
          {
              for (int n = 0; n &lt;= str.Length; n = n + 2)
              {.WriteLine(str[n]);
              }
          }
          do
          {
              string notepadPath = Environment.SystemDirectory + "\\notepad.exe";
  
              var startInfo = new ProcessStartInfo(notepadPath)
              {
                  WindowStyle = ProcessWindowStyle.Maximized,
                  Arguments = _file
              };
  
              Process.Start(startInfo);
              break;
          } while (true);
      }
      catch (Exception ex)
      {
          //handled
      }
  
      return resp;
  }
  </code></pre>
  
  <p>I have attempted to implement something like <a href="https://stackoverflow.com/questions/8897458/asp-net-download-file-to-client-browser?rq=1">this</a> but I was unable to configure it to even build. If that really is the best route to go, can someone explain it in detail and how to go about doing it?</p>