Response.Clear in ASP.NET 3.5

Question :

Response.Clear in ASP.NET 3.5,

Answer :

I have recently upgraded some of my web applications to ASP.NET 3.5 by installing the framework on the server and setting up my web applications acrodingly and all is well, however.

On some pages, I want to clear the current contents of the response buffer with code like this:

Response.Clear();  // Output some stuff  Response.End();  

But this now isn’t working in 3.5 when it did in 2.0. I have also tried setting the response buffer to false but this didn’t work either.

Read More  Ant build scripts, antcall, dependencies, etc

Can anyone let me know why it isn’t working or if there is a work around?


Try setting Buffer=”True” in the Page Directive of the page and not in codebehind.

I just tried this in VS2008 on a Web Site project:

  1. Create new item
  2. Choose “Web page”
  3. Leave all the html-tags in there, just for fun
  4. Fill the page_load like this
    protected void Page_Load(object sender, EventArgs e)    {      Response.Write("test1");      Response.Clear();      Response.Write("test2");      Response.End();    }  

It will then output “test2” without any html-tags.

That’s the answer Response.Clear in ASP.NET 3.5, Hope this helps those looking for an answer. Then we suggest to do a search for the next question and find the answer only on our site.

Read More  How to find untracked files in a Perforce tree? (analogue of svn status)

Disclaimer :

The answers provided above are only to be used to guide the learning process. The questions above are open-ended questions, meaning that many answers are not fixed as above. I hope this article can be useful, Thank you