Easy question perhaps.
Okay, I have a post to my page and need to respond with one string.
in php, you could simply do something like this:
<?php
die ("test");
then you can place this page on a webserver and access it like this:
localhost/test.php
so, I need to do exact same thing in c#.
When I try to respond with:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("test");
Response.End();
}
I’m getting: "<html><head><style type="text/css"></style></head><body>test</body></html>"
as a response.
How can I make asp.net to just return exact response, without html?
I know that I probably missing some basic knowledge, but cannot find anything online.
Make sure in your
*.aspxfile, at the top you haveAutoEventWireup="true", if it’s false (or not there?) yourPage_Loadevent 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.