Export Textbox’s text to a file using asp.net

Date: 6 Feb 2010 Comments: 0

In the Reduce Code Size Tool, I wanted to add ability for the users to be able to export the Output TextBox’s Text into file. It can be done dynamically, without need to create a temp file into the server. Here’s an asp.net example how it can be done:

Response.Clear();
Response.AddHeader(“Content-Type”, “application/html”);
Response.AddHeader(“Content-Disposition”, “attachment; filename=” + “SOME_FILENAME”);
Response.Write(_YOUR_TEXTBOX_ID.Text);
Response.Flush();
Response.End();

That’s all :)

http://www.devtheweb.net/tools/reduce-code-size.aspx

Leave a Reply


Spam protection by WP Captcha-Free