Response. Filter attribute: Modify the HTTP object data through the bound filter before the data is sent.
Application scenarios (gzip compression of website content, multi-language implementation, etc ...)
Definition: Public stream filter {Get; set ;}
For example, implement webpage compression transmission:
String STR = request. headers. Get ("Accept-encoding ");
If (STR! = NULL)
{
Stream filter = response. filter;
STR = Str. tolower ();
If (Str. Contains ("gzip "))
{
Response. Filter = new gzipstream (filter, compressionmode. Compress );
Response. appendheader ("content-encoding", "gzip ");
}
Else if (Str. Contains ("deflate "))
{
Response. Filter = new deflatestream (filter, compressionmode. Compress );
Response. appendheader ("content-encoding", "deflate ");
}
}
Note: This instance can only be used in. NET 2.0. You can directly add this function to the page.