I'm building an ASP.NET 2.0 application that involves a lot of urls with several parameters. For example:
http://www.myapp.com/default.aspx?param1=val¶m2=val2
I know that a link to that page should look like this in the HTML, with the ampersands escaped:
<a href='http://www.myapp.com/default.aspx?param1=val&param2=val2>Text</a>
So when I'm generating HTML manually for a Literal
control, I need to escape my ampersands. But do I need to do the same thing when assigning to the NavigateUrl
(MSDN) property of a HyperLink
, or is that done for me automatically? In general, where is this taken care of automatically in ASP.NET?
All ASP.Net server-side controls encode user-supplied values in the HTML they generate, except where noted otherwise in the documentation.