"
 
 
 
ASP.NET (snapshot 2017) Microsoft documentation and samples

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

by Chris Pels

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.

▶ Watch video (13 minutes)





Comments ( )
<00>  <01>  <02>  <03>  <04>  <05>  <06>  <07>  <08>  <09>  <10>  <11>  <12>  <13>  <14>  <15>  <16>  <17>  <18>  <19>  <20>  <21>  <22>  <23
Link to this page: //www.vb-net.com/AspNet-DocAndSamples-2017/aspnet/web-forms/videos/how-do-i/how-do-i-use-the-reponsefilter-property-to-replace-html-in-an-aspnet-page.htm
<SITEMAP>  <MVC>  <ASP>  <NET>  <DATA>  <KIOSK>  <FLEX>  <SQL>  <NOTES>  <LINUX>  <MONO>  <FREEWARE>  <DOCS>  <ENG>  <CHAT ME>  <ABOUT ME>  < THANKS ME>