Saturday, March 24, 2012

stripping tags from source on render

Hi,
What way could I strip certain tags (like HTML comments) from the HTML being
delivered to the client? I don't mean what regexp to use, but where do I
put this stripping code? I'm thinking something in the Global.asax, but I
can't find any reference to it having a Render or PreRender event or how to
tie into them if I did! I'd ideally like some help along the lines of:

1 - Where to put the code
2 - example of how to alter the source being delivered to the client

Thanks,
LanceHi Lance:

You could use a Response.Filter, like the one in this article:
http://www.codeproject.com/aspnet/R...pacesAspNet.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Fri, 17 Jun 2005 11:43:50 +0100, "Lance"
<lance@.[nospam]keayweb.com> wrote:

>Hi,
>What way could I strip certain tags (like HTML comments) from the HTML being
>delivered to the client? I don't mean what regexp to use, but where do I
>put this stripping code? I'm thinking something in the Global.asax, but I
>can't find any reference to it having a Render or PreRender event or how to
>tie into them if I did! I'd ideally like some help along the lines of:
>1 - Where to put the code
>2 - example of how to alter the source being delivered to the client
>Thanks,
>Lance
Hi Lance,

I'd look at the Page.Render event. This takes an HtmlTextWriter parameter
where you can modify the contents before calling the base.Render method.

HTH
--
Ian Lane

"Lance" wrote:

> Hi,
> What way could I strip certain tags (like HTML comments) from the HTML being
> delivered to the client? I don't mean what regexp to use, but where do I
> put this stripping code? I'm thinking something in the Global.asax, but I
> can't find any reference to it having a Render or PreRender event or how to
> tie into them if I did! I'd ideally like some help along the lines of:
> 1 - Where to put the code
> 2 - example of how to alter the source being delivered to the client
> Thanks,
> Lance
>
Thanks! I thought i had seen it somewhere on good 'ol codeproject!

"Scott Allen" <scott@.nospam.odetocode.com> wrote in message
news:k3s5b1drg28qbudj23ggjs1l8r861cuqhh@.4ax.com...
> Hi Lance:
> You could use a Response.Filter, like the one in this article:
> http://www.codeproject.com/aspnet/R...pacesAspNet.asp
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
> On Fri, 17 Jun 2005 11:43:50 +0100, "Lance"
> <lance@.[nospam]keayweb.com> wrote:
> >Hi,
> >What way could I strip certain tags (like HTML comments) from the HTML
being
> >delivered to the client? I don't mean what regexp to use, but where do I
> >put this stripping code? I'm thinking something in the Global.asax, but
I
> >can't find any reference to it having a Render or PreRender event or how
to
> >tie into them if I did! I'd ideally like some help along the lines of:
> >1 - Where to put the code
> >2 - example of how to alter the source being delivered to the client
> >Thanks,
> >Lance
I'd have to call the code from every page using this method, right? If I
could call it from one location (global.asax) that would be great!

"Ian Lane .enizin.net>" <ian@.<nospam> wrote in message
news:329AC863-65C0-41DC-B99E-2C47F83EA16F@.microsoft.com...
> Hi Lance,
> I'd look at the Page.Render event. This takes an HtmlTextWriter parameter
> where you can modify the contents before calling the base.Render method.
> HTH
> --
> Ian Lane
>
> "Lance" wrote:
> > Hi,
> > What way could I strip certain tags (like HTML comments) from the HTML
being
> > delivered to the client? I don't mean what regexp to use, but where do
I
> > put this stripping code? I'm thinking something in the Global.asax, but
I
> > can't find any reference to it having a Render or PreRender event or how
to
> > tie into them if I did! I'd ideally like some help along the lines of:
> > 1 - Where to put the code
> > 2 - example of how to alter the source being delivered to the client
> > Thanks,
> > Lance

0 comments:

Post a Comment