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. Easy URL Query parsing?

Easy URL Query parsing?

Scheduled Pinned Locked Moved C#
databasejsonquestion
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.
  • 3 Offline
    3 Offline
    3ddA
    wrote on last edited by
    #1

    Is there any build in functionality to parse standard query string like this: string1=hello+dear+friend%21&string2=otherdata+here+%25%26 Anything in the framework? If not I'll write it, should I put it here as an article?

    H 1 Reply Last reply
    0
    • 3 3ddA

      Is there any build in functionality to parse standard query string like this: string1=hello+dear+friend%21&string2=otherdata+here+%25%26 Anything in the framework? If not I'll write it, should I put it here as an article?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      If you're trying to parse the query string from an ASP.NET page (like an .aspx file), you can use Request.QueryString or Request.Params (combination of POST and GET variables). When getting the value from the parameter dictionary, the values are automatically decoded. Otherwise, there is many ways this can be parsed, like using String.Split with the &, the doing the same to split the key/value pairs using the = character. The HttpUtility class has both a UrlDecode and UrlEncode method, both overloaded.

      Microsoft MVP, Visual C# My Articles

      3 1 Reply Last reply
      0
      • H Heath Stewart

        If you're trying to parse the query string from an ASP.NET page (like an .aspx file), you can use Request.QueryString or Request.Params (combination of POST and GET variables). When getting the value from the parameter dictionary, the values are automatically decoded. Otherwise, there is many ways this can be parsed, like using String.Split with the &, the doing the same to split the key/value pairs using the = character. The HttpUtility class has both a UrlDecode and UrlEncode method, both overloaded.

        Microsoft MVP, Visual C# My Articles

        3 Offline
        3 Offline
        3ddA
        wrote on last edited by
        #3

        Thanx for the tip, but unfortunatly "UrlDecode" didn't work ok with some national characters like 'Ö'. So I wrote my own, and it works ok, using Uri.HexDecode.

        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