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. Web Development
  3. ASP.NET
  4. URL Encoding & Decoding ?

URL Encoding & Decoding ?

Scheduled Pinned Locked Moved ASP.NET
databasesysadminhelptutorialquestion
4 Posts 3 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.
  • S Offline
    S Offline
    Subin Alex
    wrote on last edited by
    #1

    Hi, I am Encoding my Url like : Response.Redirect("~/Default.aspx?"+Server.UrlEncode(("I1=18&I2=1&I3=506"))); It is working Fine,But When i tried to Decode the Url like : Server.UrlDecode(Request.QueryString.ToString()); It is not working as expected , It is returning the Count of Query String as 1,But i expect it as 3, Plz help me how to Decode the Querystring ? Thanx in Advance!!!!

    A L 2 Replies Last reply
    0
    • S Subin Alex

      Hi, I am Encoding my Url like : Response.Redirect("~/Default.aspx?"+Server.UrlEncode(("I1=18&I2=1&I3=506"))); It is working Fine,But When i tried to Decode the Url like : Server.UrlDecode(Request.QueryString.ToString()); It is not working as expected , It is returning the Count of Query String as 1,But i expect it as 3, Plz help me how to Decode the Querystring ? Thanx in Advance!!!!

      A Offline
      A Offline
      ami_singh
      wrote on last edited by
      #2

      there r several predefined algorithm in .net security package which can be used dirctly to encode &decode the url............ok

      S 1 Reply Last reply
      0
      • A ami_singh

        there r several predefined algorithm in .net security package which can be used dirctly to encode &decode the url............ok

        S Offline
        S Offline
        Subin Alex
        wrote on last edited by
        #3

        i used the Server.EncodeUrl() method , i am talking based on this.

        1 Reply Last reply
        0
        • S Subin Alex

          Hi, I am Encoding my Url like : Response.Redirect("~/Default.aspx?"+Server.UrlEncode(("I1=18&I2=1&I3=506"))); It is working Fine,But When i tried to Decode the Url like : Server.UrlDecode(Request.QueryString.ToString()); It is not working as expected , It is returning the Count of Query String as 1,But i expect it as 3, Plz help me how to Decode the Querystring ? Thanx in Advance!!!!

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          You should not encode the whole string "I1=18&I2=1&I3=506". Since you are encoding the three query strings I1=18&I2=1&I3=506 into one, it is loaded as a single query string in the target page. To avoid this, Encode querystring parameter I1 and the value 18 separately and join using '=' operator. Repeat this for next paramters and theri values and join with the previous set using '&'. It should be like below Response.Redirect("~/Default.aspx?"+ "encodeedI1=encoded18& encodedI2= encoded1& encdoedI3=encoded506"; Then only you can get three Query Strings in the Default.aspx.

          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