I have a php code which I have converted to asp.net code. The PHP code simply echoes a response which a client reads and interpretes, however in asp.net, the generated output is forced to be in html format -- which is precisely because I'm using asp.net labels to print the output.
Is there a way I can achieve the same thing as the echo in php or is there a very lightweight code that can help me parse the html text properly?
EDIT:
What I'm trying to do is like
//get post data
echo "Some stuff"
My current testing aspx file is:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="grabber.aspx.cs" Inherits="qProcessor.grabber" %>
and the code behind has just one method:
protected void Page_Load(object sender, EventArgs e)
{
//this.Response.Write("Welcome!");
}
Thanks.
The one-for-one equivalent would be Response.Write
:
Response.Write("some text");
That said, ASP .NET and PHP are very different frameworks. With ASP .NET (including the MVC framework) there is rarely a need to write directly to the response stream in this manner.
One such case would be if you wanted to return a very lightweight response. You could do something like this:
Response.ContentType = "text/xml";
Response.Write("<root someAttribute = 'value!' />");
Any method other than using Response
directly can (and probably will) alter the output. So in short - if you want to just dump raw data into the HttpResponse
, you'll want to use Response.Write()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With