title: Equivalent of Response. in Windows Application
body: <p>I am trying to transfer a text data to a text file and make it downlodable. It was easy in Web Application using Response. But when transfering same thing over windows i was not able to get solution we can do it by writing data to text file but how to make that file downlodable??</p>
  
  <p>This is the Code for the Web Format which i wrote</p>
  
  <pre><code>    private void ButtonSaveText_Click(object sender, EventArgs e)
      {
          //Build the Text file data.
          string TextFileData = string.Empty;
          TextFileData = TextFileData + "PAY SLIP FOR THE MONTH --------------" + Environment.NewLine + Environment.NewLine + Environment.NewLine;
          for (int i = 0; i &lt; GridViewPaySlip.Rows.Count; i++)
          {
              for (int j = 0; j &lt; GridViewPaySlip.HeaderRow.Cells.Count; j++)
              {
                  TextFileData += GridViewPaySlip.HeaderRow.Cells[j].Text + "\t\t\t" + GridViewPaySlip.Rows[i].Cells[j].Text + Environment.NewLine + Environment.NewLine + Environment.NewLine;
              }
          }
  
          //Download the Text file.
          Response.Clear();
          Response.Buffer = true;
          string FileName = String.Format("{0}__{1}{2}", "payslip", EmployeeIdTemp, ".txt");
          Response.AddHeader("content-disposition", "attachment;filename=" + FileName);
          Response.Charset = "";
          Response.ContentType = "application/text";
          Response.Output.Write(TextFileData);
          Response.Flush();
          Response.End();
      }
  </code></pre>