locked
Returning and Parsing a Url? RRS feed

  • Question

  • User995924598 posted

    I have a form with a WebBrowser in it. When the application loads, the WebBrowser opens to a site, say "microsoft.com".

    I want to write some code that extracts parts of the WebBrowser url, for example the "http://", or whatever part I want.

    How would i do that? I played around for a while and I kept on receiving an error that "WebBrowser1.Url cannot be converted to a String".

    Is there still a way to do this? Thanks!

    Wednesday, June 18, 2008 4:01 PM

Answers

  • User298974113 posted

    WebBrowser1.Url doest returns a string. It returns an object of type Uri.

    To get the URL please use this code webBrowser1.Url.AbsoluteUri

    Hope this helps!

    Please dont forget to Mark as Answer if the post helped you

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 18, 2008 4:40 PM

All replies

  • User298974113 posted

    WebBrowser1.Url doest returns a string. It returns an object of type Uri.

    To get the URL please use this code webBrowser1.Url.AbsoluteUri

    Hope this helps!

    Please dont forget to Mark as Answer if the post helped you

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, June 18, 2008 4:40 PM
  • User995924598 posted

    Wow I totally didn't know that!

    It works... I'll just have to tweak my code a bit...

    Wednesday, June 18, 2008 5:19 PM