HttpResponse.Filter Property

Gets or sets a wrapping filter object used to modify the HTTP entity body before transmission.

Namespace: System.Web
Assembly: System.Web (in system.web.dll)

public:
property Stream^ Filter {
	Stream^ get ();
	void set (Stream^ value);
}
/** @property */
public Stream get_Filter ()

/** @property */
public void set_Filter (Stream value)

public function get Filter () : Stream

public function set Filter (value : Stream)

Not applicable.

Property Value

The Stream object that acts as the output filter.

Exception typeCondition

HttpException

Filtering is not allowed with the entity.

When you create a Stream object and set the Filter property to the Stream object, all HTTP output sent by Write passes through the filter.

The following code example is an ASP.NET page that sets the Filter property to a new instance of the UpperCaseFilter class, a custom Stream class that converts all text that passes through it to uppercase. The information on the request is saved to a text file, and then the Filter property is set. After the response filter is in place, the code calls the MapPath method to get the absolute path to a text file, named TestFile.txt, that serves as the source for the content of the response. The code then creates a new StreamReader object to read the text file from beginning to end, and then calls the Write method to display the content of the file on the page.

No code example is currently available or this language may not be supported.

<%@ Page Language="VJ#" %>
<%@ import Namespace="Samples.AspNet" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    private void Page_Load(Object sender, EventArgs e)
    {
       
       // Filter the text to be rendered as all uppercase.
       get_Response().set_Filter(new UpperCaseFilterStream(get_Response().
           get_Filter()));
    
    } //Page_Load

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>ASP.NET Example</title>
</head>
<body>
    <% get_Response().Write("This text will be rendered all uppercase." ); %>
</body>
</html>

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show: