I\'m trying to write to a text file in memory and then download that file without saving the file to the hard disk. I\'m using the StringWriter
to write the con
Basically you create an HttpHandler by implementing the IHttpHandler interface. In the ProcessRequest
method you basically just write your text to context.Response
. You also need to add a Content-Disposition
http header:
context.Response.AddHeader("Content-Disposition", "attachment; filename=YourFileName.txt");
Also remember to set the ContentType
:
context.Response.ContentType = "text/plain";