Home All Groups Group Topic Archive Search About
Author
23 Jan 2006 3:07 PM
Aaron
Dim sbRegX As New StringBuilder(HttpUtility.HtmlEncode(txtComments.Text))

sbRegX.Replace("&lt;a&gt;", "<a>")

sbRegX.Replace("&lt;/a&gt;", "")



How do I get the attributes of href and target to be encoded?

Author
23 Jan 2006 3:13 PM
Herfried K. Wagner [MVP]
"Aaron" <fromthe***@aaronminoo.com> schrieb:
>Dim sbRegX As New StringBuilder(HttpUtility.HtmlEncode(txtComments.Text))
>sbRegX.Replace("&lt;a&gt;", "<a>")
>sbRegX.Replace("&lt;/a&gt;", "")
>
>How do I get the attributes of href and target to be encoded?

Encoded as what?

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
23 Jan 2006 4:11 PM
Aaron
Herfried,

I have a text box that could have <a href="yahoo.com"
target="_new">yahoo</a>

With just
sbRegX.Replace("&lt;a&gt;", "<a>")
sbRegX.Replace("&lt;/a&gt;", ""</a>)

The output is
<a href="yahoo.com" target="_blank">Yahoo
and the data looks like this
&amp;lt;a href=&amp;quot;yahoo.com&amp;quot;
target=&amp;quot;_blank&amp;quot;&amp;gt;Yahoo&lt;/a&gt;,



I need it to look like http://www.yahoo.com  with it in a new window.

TIA

Aaron

Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:uEsaI%23CIGHA.3944@tk2msftngp13.phx.gbl...
> "Aaron" <fromthe***@aaronminoo.com> schrieb:
> >Dim sbRegX As New StringBuilder(HttpUtility.HtmlEncode(txtComments.Text))
> >sbRegX.Replace("&lt;a&gt;", "<a>")
> >sbRegX.Replace("&lt;/a&gt;", "")
> >
> >How do I get the attributes of href and target to be encoded?
>
> Encoded as what?
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
Author
23 Jan 2006 4:19 PM
S. Justin Gengo [MCP]
Aaron,

You'll be looking for Server.HtmlEncode and Server.HtmlDecode. You may also
want to experiment (depending on all the uses of the input text) with
Sever.UrlEncode and Server.UrlDecode.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
                            Nietzsche
Show quoteHide quote
"Aaron" <fromthe***@aaronminoo.com> wrote in message
news:eGhc$WDIGHA.3728@tk2msftngp13.phx.gbl...
> Herfried,
>
> I have a text box that could have <a href="yahoo.com"
> target="_new">yahoo</a>
>
> With just
> sbRegX.Replace("&lt;a&gt;", "<a>")
> sbRegX.Replace("&lt;/a&gt;", ""</a>)
>
> The output is
> <a href="yahoo.com" target="_blank">Yahoo
> and the data looks like this
> &amp;lt;a href=&amp;quot;yahoo.com&amp;quot;
> target=&amp;quot;_blank&amp;quot;&amp;gt;Yahoo&lt;/a&gt;,
>
>
>
> I need it to look like http://www.yahoo.com  with it in a new window.
>
> TIA
>
> Aaron
>
> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
> news:uEsaI%23CIGHA.3944@tk2msftngp13.phx.gbl...
>> "Aaron" <fromthe***@aaronminoo.com> schrieb:
>> >Dim sbRegX As New
>> >StringBuilder(HttpUtility.HtmlEncode(txtComments.Text))
>> >sbRegX.Replace("&lt;a&gt;", "<a>")
>> >sbRegX.Replace("&lt;/a&gt;", "")
>> >
>> >How do I get the attributes of href and target to be encoded?
>>
>> Encoded as what?
>>
>> --
>>  M S   Herfried K. Wagner
>> M V P  <URL:http://dotnet.mvps.org/>
>>  V B   <URL:http://classicvb.org/petition/>
>
>