ASP.NET: How Do I: Use the Reponse.Filter Property to Replace HTML in an ASP.NET Page

Posted in Frameworks, Companies, Development on April 12, 2009

Get Microsoft Silverlight

In this video Chris Pels shows how to use the Reponse.Filter property to intercept and alter the HTML being sent to a page. First, a sample page is created with some simple text. Then, a custom Stream class is created which serves as the replacement stream for the current stream being sent to the user’s browser. In that custom stream class the contents of the page are retrieved from the stream, altered, and then written out to the response stream. In this custom Stream class the Write method is customized to replace the HTML in the base Response stream, thereby altering what is sent to the user’s browser. Finally, the new stream class is assigned to the Response.Filter property in the Page_Load event, thereby, providing the mechanism for altering the page content.

Presented by Chris Pels

Date: 29 January 2009

Watch Video Watch Video Watch Video on External Site

Tags: Frameworks, Microsoft, ASP.NET, .NET Framework, Broadcasting, Screencasts, Development, Companies