Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   HyperLink control and HTML encoding (http://www.velocityreviews.com/forums/t724972-hyperlink-control-and-html-encoding.html)

John A. 06-07-2010 01:56 PM

HyperLink control and HTML encoding
 
If I have a hyperlink control like this:

<asp:HyperLink ID="HyperLink1" runat="server"
Text="&'><"
ToolTip="&'><"
NavigateUrl="~/">
</asp:HyperLink>

it renders as:

<a id="HyperLink1" title="&amp;'>&lt;" href="/">&'><</a>

Am I to understand that the Text attribute's value is never encoded, and
the ToolTip's value is encoded by default? If so, according to what
rules, since the > is not converted to &gt;?

Andrew Morton 06-07-2010 02:05 PM

Re: HyperLink control and HTML encoding
 
John A. wrote:
> If I have a hyperlink control like this:
>
> <asp:HyperLink ID="HyperLink1" runat="server"
> Text="&'><"
> ToolTip="&'><"
> NavigateUrl="~/">
> </asp:HyperLink>
>
> it renders as:
>
> <a id="HyperLink1" title="&amp;'>&lt;" href="/">&'><</a>
>
> Am I to understand that the Text attribute's value is never encoded,
> and the ToolTip's value is encoded by default? If so, according to
> what rules, since the > is not converted to &gt;?


It looks like the Text attribute is taken literally - otherwise you couldn't
put any markup in it.

As long as all the < are encoded, the > don't need to be.

--
Andrew




All times are GMT. The time now is 11:55 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57