Hi guys... I am trainee in .net. I am currently trying to make web form notepad. For the save option I have used the save button on open and new page using the code as bellow but I am facing problem as the file is downloaded and the file with is saved are different. The downloaded file as shown in browser does not contain any content and the saved file contain the document. So I want to make the save file and downloaded file same. Can anyone solve my problem.
Thank you in Advance...
protected void SaveButton_Click(object sender, EventArgs e)
{
Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition", "attachment; filename=document.txt");
StreamWriter sw = new StreamWriter("C:\\Users\\admin\\Desktop\\Downloads\\documents.txt");
sw.Write(TextBox1.Text);
sw.Close();
Response.End();
}