5 Replies Latest reply on Apr 4, 2007 6:59 AM by insuractive

    #CGI.SCRIPt_NAME#

    krusej2311
      I am creating a secure page that uses variables for the url from the page before it. My coldfusion MX book tells me to use the #CGI.SCRIPt_NAME# variable so that when the user logs into the page it will continue to where they wanted to go but this does not work for me. I get an error saying that the variable could not be found. Is there a way to carry the url and variables that it was using at first through all of the pages it has to run through to check the users authentication? Thanks
        • 1. Re: #CGI.SCRIPt_NAME#
          Level 7
          #cgi.script_name#?#cgi.query_string#

          --

          Azadi Saryev
          Sabai-dee.com
          http://www.sabai-dee.com
          • 2. Re: #CGI.SCRIPt_NAME#
            Level 7
            > I get an error saying that
            > the variable could not be found.

            You shouldn't get an error saying a CGI-scoped variable was not found. CF
            always - for some daft reason - treats any non-existent CGI variable as an
            empty string. isDefined() on a CGI variable always returns true.
            structKeyExists() is more reliable, though, and will return false if indeed
            the variable does not exist.

            --
            Adam
            • 3. Re: #CGI.SCRIPt_NAME#
              krusej23111
              quote:

              Originally posted by: Newsgroup User
              #cgi.script_name#?#cgi.query_string#

              What's that going to do for me?
              • 4. Re: #CGI.SCRIPt_NAME#
                BKBK Adobe Community Professional & MVP
                CGI.SCRIPT_NAME is the path to the script that is currently executing. When your users "continue to where they wanted to go", the path to the new page becomes the new value of CGI.SCRIPT_NAME, which is in general different from that of the previous page. Could there possibly be some confusion there?

                Is there a way to carry the url and variables that it was using at first through all of the pages it has to run through to check the users authentication?
                Yes. For example, Coldfusion can carry them from page to page as session, URL or hidden form variables.

                • 5. Re: #CGI.SCRIPt_NAME#
                  insuractive Level 3
                  CGI.Query_String contains a tokenized list of all of your URL variables (e.g. myvar=1&hello=world). If you would like to learn a little more about what information you have available to you in the CGI variables, simply do a <cfdump var="#CGI#">. That should point you in the right direction.