Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
Linklabel deletes ampersand & when setting Text property
posted

I am trying to set the Text property like this:

  lnkHTTPService.Text = "http://localhost:" & numWebAPIPort.Value.ToString & "/VisualCron/xml/logon?username=admin&password=qwerty123"

http://screencast.com/t/8TCqgOa0j

So, I added an extra % and it looked good (only one & was seen) but then a customer complained that it saw two && in form. What is happening?

  • 69832
    Suggested Answer
    Offline posted

    The ampersand (&) is a special character in HTML. When you want one to appear in a URI you have to escape it, i.e., replace it with the string '&'.

    Note that the ParsedFormattedTextValue class exposes a static method, EscapeXML, which does this for you.