HttpResponse.Filter clearing and what is happening behind the scenes

C

Chris Simmons

Hello:

I am trying to better understand the HttpResponse.Filter property and,
although I think I "get it," I am wondering what is going on behind
the scenes.

I was initially stumped with the thing because all the samples I came
across kept using the property as an argument to the custom filter
Stream's constructor. What I then figured out was that this is the
way that multiple filters can be chained onto the Response stream. For
example:

// C# Code follows

// Add a filter to the stream
SomeCustomStreamFilter aFilter =
new SomeCustomStreamFilter( Response.Filter );
Response.Filter = aFilter;

// ...

// Attach another filter to the stream
AnotherCustomFilter anotherFilter =
new AnotherCustomFilter( Response.Filter );
Response.Filter = anotherFilter;

// C# Code ends

The only questions I had remaining are:
1. To what is HttpResponse.Filter initially set?
2. How do you clear the filter (remove any filters)? Set it to null?

Assuming you set the filter to null, is there something underneath the
covers that tells Response to then just start sending Response.Write
directly to the output stream?

Or perhaps I am just totally not understanding the whole concept. Can
someone enlighten me?

Thanks ...
 
B

bruce barker

logically its the HttpResponse's original OutputStream.

-- bruce (sqlwork.com)


| Hello:
|
| I am trying to better understand the HttpResponse.Filter property and,
| although I think I "get it," I am wondering what is going on behind
| the scenes.
|
| I was initially stumped with the thing because all the samples I came
| across kept using the property as an argument to the custom filter
| Stream's constructor. What I then figured out was that this is the
| way that multiple filters can be chained onto the Response stream. For
| example:
|
| // C# Code follows
|
| // Add a filter to the stream
| SomeCustomStreamFilter aFilter =
| new SomeCustomStreamFilter( Response.Filter );
| Response.Filter = aFilter;
|
| // ...
|
| // Attach another filter to the stream
| AnotherCustomFilter anotherFilter =
| new AnotherCustomFilter( Response.Filter );
| Response.Filter = anotherFilter;
|
| // C# Code ends
|
| The only questions I had remaining are:
| 1. To what is HttpResponse.Filter initially set?
| 2. How do you clear the filter (remove any filters)? Set it to null?
|
| Assuming you set the filter to null, is there something underneath the
| covers that tells Response to then just start sending Response.Write
| directly to the output stream?
|
| Or perhaps I am just totally not understanding the whole concept. Can
| someone enlighten me?
|
| Thanks ...
| --
| Chris Simmons
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top