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 ...
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 ...