Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Uri bug??

System.Uri bug??

Scheduled Pinned Locked Moved C#
debugginghelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jason Manfield
    wrote on last edited by
    #1

    I have the following URL: http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http://citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf Creating System.Uri with the above URL: Uri uri = new Uri(aboveURL) removes the extra slash after "Download/http://". The debugger shows it as Download/http:/citeseer.ist.... The Uri in HttpWebRequest (which is created with the above URL) also removes the extra slash. As a result, I get NameResolution exception. The Uri is shown as http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http:/citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf

    M 1 Reply Last reply
    0
    • J Jason Manfield

      I have the following URL: http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http://citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf Creating System.Uri with the above URL: Uri uri = new Uri(aboveURL) removes the extra slash after "Download/http://". The debugger shows it as Download/http:/citeseer.ist.... The Uri in HttpWebRequest (which is created with the above URL) also removes the extra slash. As a result, I get NameResolution exception. The Uri is shown as http://citeseer.ist.psu.edu/rd/55811103,653,1,0.25,Download/http:/citeseer.ist.psu.edu/cache/papers/cs/7145/http:zSzzSzwww.stanford.eduzSzclasszSzcs343zSzpszSzpathprof.pdf/ball96efficient.pdf

      M Offline
      M Offline
      Miszou
      wrote on last edited by
      #2

      You could try using the UrlEncode/UrlDecode functions in the HttpUtility class.


      The StartPage Randomizer

      J 1 Reply Last reply
      0
      • M Miszou

        You could try using the UrlEncode/UrlDecode functions in the HttpUtility class.


        The StartPage Randomizer

        J Offline
        J Offline
        Jason Manfield
        wrote on last edited by
        #3

        Using HttpUtility.Encode results in System.Uri throwing an exception, since it can't process the encoded info. Uri uri = new Uri(HttpUtility.UrlEncode(url));

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups