How to get access to the complete HTML just before its sent to the client

R

Rahul Agarwal

Hi

In our web page we use a combination of HTML and server side controls and
some of them have a custom attribute based on which we need to find and
replace the values once the HTML is ready.

For e.g. <LABEL DICTCODE="XYZ">Some text</LABEL>

At run time just before the complete HTML is sent to the client-side I want
to get hold of the HTML so that I can find and replace all the HTML elements
with DICTCODE attribute with some custom value.

Please advice.
Thanks
Rahul
 
R

Rahul Agarwal

Hi Jim and Bruce

Thanks for you reply, it was a good e.g. to understand how we can get access
to the HTML just before rendering out. Can I take this a step further and
ask if it is possible that since I have access to the HTML I can add my
translation before rendering out but can I save the new HTML (with
translation) in to a Cache and for the next request just use the cache and
avoid the full page construction (rendering of each controls, etc) as I have
already got the HTML from the last request.

Is it possible and is it a good idea. The reason I am asking this that in
many of our pages we hardly use server side controls its mainly HTML
elements and we need to do some translation just before is rendered but to
improve performance can I generate the HTML once and reuse it again and
again.

Thanks a lot
Rahul Agarwal


Jim Cheshire said:
Hi Rahul,

You can do that using a Stream object. I have a simple sample that does
it. I've attached it.

Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
From: "Rahul Agarwal" <[email protected]>
Subject: How to get access to the complete HTML just before its sent to the client
Date: Thu, 5 Aug 2004 10:32:01 +1000
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 203.11.225.5
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:252243
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi

In our web page we use a combination of HTML and server side controls and
some of them have a custom attribute based on which we need to find and
replace the values once the HTML is ready.

For e.g. <LABEL DICTCODE="XYZ">Some text</LABEL>

At run time just before the complete HTML is sent to the client-side I want
to get hold of the HTML so that I can find and replace all the HTML elements
with DICTCODE attribute with some custom value.

Please advice.
Thanks
Rahul
 
J

Jim Cheshire [MSFT]

Rahul,

You can do that by overriding the Render method in your own base class.

Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
From: "Rahul Agarwal" <[email protected]>
References: <[email protected]>
Subject: Re: How to get access to the complete HTML just before its sent to the client
Date: Fri, 6 Aug 2004 10:47:20 +1000
Lines: 74
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 203.11.225.5
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13
..phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:252480
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi Jim and Bruce

Thanks for you reply, it was a good e.g. to understand how we can get access
to the HTML just before rendering out. Can I take this a step further and
ask if it is possible that since I have access to the HTML I can add my
translation before rendering out but can I save the new HTML (with
translation) in to a Cache and for the next request just use the cache and
avoid the full page construction (rendering of each controls, etc) as I have
already got the HTML from the last request.

Is it possible and is it a good idea. The reason I am asking this that in
many of our pages we hardly use server side controls its mainly HTML
elements and we need to do some translation just before is rendered but to
improve performance can I generate the HTML once and reuse it again and
again.

Thanks a lot
Rahul Agarwal


Jim Cheshire said:
Hi Rahul,

You can do that using a Stream object. I have a simple sample that does
it. I've attached it.

Jim Cheshire [MSFT]
MCP+I, MCSE, MCSD, MCDBA
Microsoft Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
From: "Rahul Agarwal" <[email protected]>
Subject: How to get access to the complete HTML just before its sent to the client
Date: Thu, 5 Aug 2004 10:32:01 +1000
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 203.11.225.5
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:252243
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Hi

In our web page we use a combination of HTML and server side controls and
some of them have a custom attribute based on which we need to find and
replace the values once the HTML is ready.

For e.g. <LABEL DICTCODE="XYZ">Some text</LABEL>

At run time just before the complete HTML is sent to the client-side I want
to get hold of the HTML so that I can find and replace all the HTML elements
with DICTCODE attribute with some custom value.

Please advice.
Thanks
Rahul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top