views:

272

answers:

3
context.Response.ContentType = "text/plain";
context.Response.Write(returnString);

If returnString is NULL what will it pass, or will it fail?

EDIT: The question was if it is possible, the above was just an example which I realize I could have tested. However I am looking for any other possible ways to do this beyond just my code example, I just couldn't think of anything else to write in the body text without repeating information that is already in the question title.

+1  A: 

It is equivalent to passing an empty string to Response.Write.

Jakob Christensen
A: 

Can't you test it?

Juan Manuel
+1  A: 

While I agree with the sentiment of others in that it probably would have been pretty easy to test this rather than to ask the question... But, since you asked, here is a code sample for you. The result of the code was no text being displayed on the screen.

    protected void Page_Load(object sender, EventArgs e)
    {
        string myString = null;
        Response.ContentType = "text/plain";
        Response.Write(myString);
        Response.End();
    }
RSolberg
do you think this will be received as null or as "" seeing as the content type is text/plain I am unsure if it can store a value that would be read as null...
shogun
I'm not sure... Can you give me a little more context on what you are trying to accomplish with the response.write?
RSolberg