ASP.NET Response.Write ()- only the text without HTML formatting


I am doing the following to write to reponse

Response.Write("My String");

This writes perfectly on the web browser

But then I use another Web application to leech the response I found the text to be formatted with HTML in additiopn to \R\N (new line )

When i go and view source I find the following

      My String

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
      Untitled Page
    <form name="form1" method="post" action="process.aspx?Input=7777" id="form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNzgzNDMwNTMzZGRr7t66L1bFbpKua9rQ+II9N4P8bA==" />



From the content it looks like the request is return on the response too..

All i want is to send "My String" as plain text..
Any help is appreciated
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

justin_smithAuthor Commented:
Is it due to Session or something?
justin_smithAuthor Commented:
I found the reasson why those HTML tags appeared there.. It was becuase i didnt remove the HTML/ASP tage when i create webforms

But the new lines and carriage returns are stilll present

Any help?
Try usign
Response.Write("My String");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
What you need to do is to end the response, otherwise the other code in your ASP.NET application (the code you don't see but is executed before, between and after the well-known events) will output their data.

You don't even have to remove the HTML or ASP.NET code. If, in an early event (Init or even PreInit for instance), you use the code shown by strider_1981, including the Response.End(), then other data will not be sent.

One thing to look out for: it is possible that, if you place your code in a rather late event (Page_Load, or even Page_Unload) that some data has already been flushed back to the browser. In that case, Response.Clear() will have no effect. Which is why you must place this code as early in the event chain as possible.
justin_smithAuthor Commented:
I had to add Response.Flush() in the end...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.