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. Query String Weirdness

Query String Weirdness

Scheduled Pinned Locked Moved ASP.NET
databasequestion
7 Posts 4 Posters 1 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
    Sam Heller
    wrote on last edited by
    #1

    The following code, PageDetails.Request.QueryString.ToString() Returns the following. NewsID=66NewsID=66 Any ideas anyone?

    C T M 3 Replies Last reply
    0
    • S Sam Heller

      The following code, PageDetails.Request.QueryString.ToString() Returns the following. NewsID=66NewsID=66 Any ideas anyone?

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

      I take it the newsId only appears in there once ? Why are you calling ToString ?

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      S 1 Reply Last reply
      0
      • S Sam Heller

        The following code, PageDetails.Request.QueryString.ToString() Returns the following. NewsID=66NewsID=66 Any ideas anyone?

        T Offline
        T Offline
        Talal Sultan
        wrote on last edited by
        #3

        Calling the ToString() method will return a string representation of QueryString which is a NameValueCollection. I would guess that you have passed the same parameter twice to the page URL with the same value? Talal

        -- If this is a post that has been helpful to you, please vote for it. Thank you! "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." --Rich Cook

        1 Reply Last reply
        0
        • S Sam Heller

          The following code, PageDetails.Request.QueryString.ToString() Returns the following. NewsID=66NewsID=66 Any ideas anyone?

          M Offline
          M Offline
          Michael Sync
          wrote on last edited by
          #4

          hum? I don't think it's strange. "NewsID=66NewsID=66" is something that you pass it to this page.. Steps to reproduce this ~ #1. Create web project #2. Write the following code in Page_Load. string a = Request.QueryString.ToString(); Response.Write(a); #3. Run the application. (Observe: You will see nothing since there is nothing in parameter.) #4. Type Like that "http://localhost:49614/WebSite4/Default.aspx?NewsID=66NewsID=66" in browser. (Note: Website4 should be the name of your website.) You will see the following in your page. NewsID=66NewsID%3d66 If you use this codeRequest.QueryString.ToString();, you will get all parameters. If you wanna get individual one, use like that "Request.QueryString[0]" Let me know if I miss something..

          Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

          S 1 Reply Last reply
          0
          • C Christian Graus

            I take it the newsId only appears in there once ? Why are you calling ToString ?

            Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            S Offline
            S Offline
            Sam Heller
            wrote on last edited by
            #5

            The query string is http://localhost:49614/WebSite4/Default.aspx?NewsID=66 Will ToString() have any affect? ie a doubling effect?

            1 Reply Last reply
            0
            • M Michael Sync

              hum? I don't think it's strange. "NewsID=66NewsID=66" is something that you pass it to this page.. Steps to reproduce this ~ #1. Create web project #2. Write the following code in Page_Load. string a = Request.QueryString.ToString(); Response.Write(a); #3. Run the application. (Observe: You will see nothing since there is nothing in parameter.) #4. Type Like that "http://localhost:49614/WebSite4/Default.aspx?NewsID=66NewsID=66" in browser. (Note: Website4 should be the name of your website.) You will see the following in your page. NewsID=66NewsID%3d66 If you use this codeRequest.QueryString.ToString();, you will get all parameters. If you wanna get individual one, use like that "Request.QueryString[0]" Let me know if I miss something..

              Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

              S Offline
              S Offline
              Sam Heller
              wrote on last edited by
              #6

              The query string is as follows The query string is http://localhost:49614/WebSite4/Default.aspx?NewsID=66 As copied from the URL

              M 1 Reply Last reply
              0
              • S Sam Heller

                The query string is as follows The query string is http://localhost:49614/WebSite4/Default.aspx?NewsID=66 As copied from the URL

                M Offline
                M Offline
                Michael Sync
                wrote on last edited by
                #7

                Sam Heller wrote:

                The query string is http://localhost:49614/WebSite4/Default.aspx?NewsID=66

                No.. I have tried with your querystring. (Environment: Windows Vista, Visual Studio 2005 C#) I got only

                NewsID=66

                . I suggest you to create new project and try again... If you still getting this issue, show us the sample code.

                Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you. :)

                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