Hi ,
I should create a .txt file dynamically . After the text file is created, it should be downloaded by the user. For this purpose , I try the code (I simplified the code basically like below ):
string blabla= "Hello World";
Response.Clear();
Response.ContentType = "text/plain";
Response.AddHeader("Exported text File", "attachment; filename=helloWorld.txt");
Response.ContentEncoding = Encoding.Default;
byte[] bytes = Encoding.Default.GetBytes(blabla);
Response.BinaryWrite(bytes);
Response.End();
But this code block behaves like Response.Write() . The content is written at the download page. There is no file to be downloaded.
Thanks for the replies in advance..