473,322 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Response.Clear() doesn't clear

When I use Response.Clear() it doesn't seem to have an effect. The original
aspx page code remains. I have tried creating test projects in both VS 2005 &
2008, where I just add a new aspx page and place in the Page_Load() event
Response.Clear(), but nothing is cleared out. I have tried various ways to
get the page to clear, including the code below:

protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/html";
Response.Clear();
Response.BufferOutput = true;
Response.Write("<html><body>Testing</body></html>");
Response.Flush();
}

The page will have the <html><body>Testing</body></htmlat the top of the
page's code file, but all of the original default aspx code will still be
there also. I have tried this with both ASP .NET 2.0 & 3.5 in VS 2008. I have
looked at a lot of examples on the Internet and have not seen anything else
mentioned that is necessary. Is there something else that I am missing?
Jan 31 '08 #1
1 9387
I also find it most useful to set the Buffer in the page directive and note
in the codebehind. This way you don't have to worry about the timing of
things as it's possible to set the buffer too late in the event cycle.
--
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - Expression
"David" <Da***@discussions.microsoft.comwrote in message
news:0C**********************************@microsof t.com...
When I use Response.Clear() it doesn't seem to have an effect. The
original
aspx page code remains. I have tried creating test projects in both VS
2005 &
2008, where I just add a new aspx page and place in the Page_Load() event
Response.Clear(), but nothing is cleared out. I have tried various ways to
get the page to clear, including the code below:

protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "text/html";
Response.Clear();
Response.BufferOutput = true;
Response.Write("<html><body>Testing</body></html>");
Response.Flush();
}

The page will have the <html><body>Testing</body></htmlat the top of the
page's code file, but all of the original default aspx code will still be
there also. I have tried this with both ASP .NET 2.0 & 3.5 in VS 2008. I
have
looked at a lot of examples on the Internet and have not seen anything
else
mentioned that is necessary. Is there something else that I am missing?
Jan 31 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Dominic Godin | last post by:
Hi, I have an asp page that does a lot of processing and reports it's finished by printing the word "Success". For example: <% SomeFunction(SomeVar) SomeFunction(SomeVar1) ...
0
by: ProJee | last post by:
Hi, Response.WriteFile (or Response.OutputStream.Write) finishes immediately, not after the file is completely downloaded. It finishes before (!) the user clicks the "Save" or "Open" browser...
2
by: David Union | last post by:
Hi. I'm posting this here because I don't know exactly what the best group is. This is for an aspx page with Visual Basic as the code-behind page. I am doing very simple code... in the middle...
3
by: Jocelyn Duhaylungsod | last post by:
I have been getting the following server errors sporadically while downloading excel, csv or xml file. Internet Explorer cannot download <file name> from <IP address> "The server returned an...
0
by: PD | last post by:
I am trying to stream out a PDF file via the response object and when I execute the code it always brings up the first document that I pulled up.Even when I step through the code, I can see the new...
1
by: ocbka1 | last post by:
i'm using creating a webpage on the fly that i save as an xls file to be attached to an email and sent dynamically. i've got a custom response filter class to write it out. the problems start...
1
by: nettleby | last post by:
The Microsoft site has confused me on this issue: http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/iisbook/c06_redirection.mspx?mfr=true Says that: "ASP automatically discards...
4
by: matt | last post by:
hello, so from time to time i have to write code to send a file or a stream back to the end user. in my mini library i have code to do so. however, some of the Response object properties arent...
3
by: darrel | last post by:
I'm creating an RSS feed based off of this tutorial: http://www.uberasp.net/ArticlePrint.aspx?id=17 In a nutshell, they are doing: Response.Clear() Response.ContentType = "text/xml"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.