Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > stringbuilder help

Reply
Thread Tools

stringbuilder help

 
 
Aaron
Guest
Posts: n/a
 
      01-23-2006
Dim sbRegX As New StringBuilder(HttpUtility.HtmlEncode(txtComments.T ext))

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

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



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





 
Reply With Quote
 
 
 
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      01-23-2006
"Aaron" <(E-Mail Removed)> schrieb:
>Dim sbRegX As New StringBuilder(HttpUtility.HtmlEncode(txtComments.T ext))
>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/>
 
Reply With Quote
 
 
 
 
Aaron
Guest
Posts: n/a
 
      01-23-2006
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]" <(E-Mail Removed)> wrote in message
news:uEsaI%(E-Mail Removed)...
> "Aaron" <(E-Mail Removed)> schrieb:
> >Dim sbRegX As New StringBuilder(HttpUtility.HtmlEncode(txtComments.T ext))
> >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/>



 
Reply With Quote
 
S. Justin Gengo [MCP]
Guest
Posts: n/a
 
      01-23-2006
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
"Aaron" <(E-Mail Removed)> wrote in message
news:eGhc$(E-Mail Removed)...
> 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]" <(E-Mail Removed)> wrote in message
> news:uEsaI%(E-Mail Removed)...
>> "Aaron" <(E-Mail Removed)> 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/>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
string vs stringbuilder H.G.Srivatsa ASP .Net 3 08-25-2005 01:55 PM
Double Quotes in a stringbuilder =?Utf-8?B?SnVzdGlu?= ASP .Net 2 03-18-2005 12:57 AM
Does a StringBuilder effect Viewstate variable size? darrel ASP .Net 2 01-28-2005 11:31 PM
How to reset a StringBuilder? ESPN Lover ASP .Net 2 10-14-2004 03:42 PM
no stringbuilder in C#2.0? =?Utf-8?B?SGFuZGk=?= ASP .Net 2 09-11-2004 08:27 AM



Advertisments