How to respond without html in asp.net
You can clear the previous response buffer and write your new output.
Response.Clear(); // clear response buffer
Response.Write("test"); // write your new text
Response.End(); // end the response so it is sent to the client
Make sure in your *.aspx
file, at the top you have AutoEventWireup="true"
, if it's false (or not there?) your Page_Load
event handler will not be called.
Also, make sure you compiled your page.
Another suggestion is to use a Generic Handler
(ie *.ashx
), these do not use the typical webforms lifecycle and might be better suited to what you're doing.
I think you're looking for :
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/plain";
Response.Write("test");
Response.End();
}