"Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message
news:Oq**************@TK2MSFTNGP09.phx.gbl...
Server.URLEncode(TheString)
I'm pretty sure there's an HTMLEncode one aswell but, never had a need to
know so can't say for sure.
As the name would suggest, URLEncode is for encoding URL values, and
HTMLEncode is for encoding regular HTML. They are different, so don't try
to use URLEncode as a catch all. For example:
<%
' Double the quotes to put a double quote in the string value
val = "4"" X 8"""
%>
<input type="text" name="size" value="<%=Server.HTMLEncode(val)%>">
<input type="text" name="size" value="<%=Server.URLEncode(val)%>">
The output above will look like this:
<input type="text" name="size" value="4" X 8"">
<input type="text" name="size" value="4%22+X+8%22">
Note, the first one will look correct in browsers... the 2nd will not.
Regards,
Peter Foti