The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
WebBrowserTask URL problem RRS feed

  • Question

  • I'm seeing truncated URLs when using WebBrowserTask. For example, setting the URL to http://www.hostname.com/cgi-bin/guide?ver=1.0&ed=demo, launches the browser with the URL http://www.hostname.com/cgi-bin/guide?ver=1.0. Is this a bug?
    Wednesday, October 13, 2010 3:23 PM

Answers

All replies

  • You can use UrlEncode to protect the URL string structure as it gets passed to the browser application.

    For example:

    myBrowserTask.URL = HttpUtility.UrlEncode("http://www.hostname.com/cgi-bin/guide?ver=1.0&ed=demo");

    Thanks,
    -Eric.

    Wednesday, October 13, 2010 5:07 PM
  • Also look at using &amp instead of just &.
    Wednesday, October 13, 2010 7:58 PM
  • It is a bit odd, but UrlEncode does work.
    Wednesday, October 13, 2010 8:14 PM
  • I could understand it if the URL needed to be escaped but ampersand is a perfectly valid URL character as used above. It is pretty strange that the URL won't work in raw form - smells like an issue to me.

    The WebBrowserTask shouldn't require that the given URL be escaped as if it originated from an XML attribute (i.e. from XAML) when specified in code as above. I understand that the URL coming from XAML is likely the most common scenario, but that fact shouldn't make it the only one that works.
    Wednesday, October 13, 2010 8:21 PM
  • FWIW: A bug report has been submitted for this problem.

    Wednesday, October 13, 2010 10:25 PM