[thelist] Function to strip HTML in ASP

aardvark roselli at earthlink.net
Mon Jul 10 02:16:52 CDT 2000


have you tried Server.HTMLEncode(strWebPage)  ?

or even do a replace on < and >...

<%
strWebPage = Replace(strWebPage,"<","&lt;")
strWebPage = Replace(strWebPage,">","&gt;")
%>

either one can do the trick...

this still shows the HTML as plain text, however (i thought that's what you were asking at first, 
but i decided to leave it anyway)... if you wanna strip the HTML *completely*, well, what 
version of IIS/ASP you got running?  older versions lack simple regular expressions, so a 
somewhat complex function will have to be employed to get the majority of tags... that function 
can also vary depending on the version of ASP you have as well...

> -----Original Message-----
> From: Madhu Menon
> 
> I was wondering if any of you kind folks could 
> think of how to make a
> function in ASP to strip out all HTML from a web 
> page and convert it
> to plain text. I have a wonderful utility called 
[...]
> 
> For brevity's sake, let's assume the web page has 
> been loaded into a variable called strWebPage.





More information about the thelist mailing list