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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem in using query string

Problem in using query string

Scheduled Pinned Locked Moved ASP.NET
databasehelp
3 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
    souravghosh18
    wrote on last edited by
    #1

    In my application I am using query string.But i have faced some problem.when i am passing values which has special characters like (&) or (') it encounters a problem. it only takes the value before special characters.For eg:if i pass value "Finance&Account" then it only give the value"Finance" at the other page.Is there any way to handle it. Thanks in advance.

    C P 2 Replies Last reply
    0
    • S souravghosh18

      In my application I am using query string.But i have faced some problem.when i am passing values which has special characters like (&) or (') it encounters a problem. it only takes the value before special characters.For eg:if i pass value "Finance&Account" then it only give the value"Finance" at the other page.Is there any way to handle it. Thanks in advance.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You need to encode the &, otherwise it means a new variable. There's URL encode methods inside .NET.

      Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp

      1 Reply Last reply
      0
      • S souravghosh18

        In my application I am using query string.But i have faced some problem.when i am passing values which has special characters like (&) or (') it encounters a problem. it only takes the value before special characters.For eg:if i pass value "Finance&Account" then it only give the value"Finance" at the other page.Is there any way to handle it. Thanks in advance.

        P Offline
        P Offline
        padmanabhan N
        wrote on last edited by
        #3

        you have to use encode and decode functionality: //encode string aa = "Finance&Account"; string url = string.Format("Default1.aspx?name={0}", Server.UrlEncode(aa)); Response.Redirect(url); //decode name = Server.UrlDecode(Request.QueryString["name"]);

        Padmanabhan

        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