6 Replies Latest reply on Mar 26, 2009 11:37 AM by Newsgroup_User

    CGI problem

    aaronsven
      Hello, I'm having an erro with Coldfusion, and I'm curious if this is a known issue, or if it's something I can fix on my side.

      Well the biggest problem is that a page that I have that uses an insert statement is inserting the record it's supposed to insert once, twice. So I'm getting double the records inserted into the database than I want.

      I checked the IIS logs, and I see three requests for the page with the following status codes: 401.5, 401.1 then 200. I use the CGI username to log the user in, because that way the user doesn't have to type in their username and password everytime they log in. So what I'm getting from those status codes is that the page is trying to get the CGI variables, it fails, then it gives the generic login failed status, then it finally gets the user's info and logs them in correctly.

      I'm trying to find out if there's someway that I can get the user to login on the first request instead of having to make 3 of them everytime. I am using coldfusion version 6,1,0,83762. Is that something that that version of Coldfusion just has problems with or is there something that I can do to fix this?

      Any help would be absolutely amazing, and I appreciate your time immensely

      Thanks again,
      Aaron
        • 1. Re: CGI problem
          Level 7
          aaronsven wrote:
          > Hello, I'm having an erro with Coldfusion, and I'm curious if this is a known
          > issue, or if it's something I can fix on my side.
          >
          > Well the biggest problem is that a page that I have that uses an insert
          > statement is inserting the record it's supposed to insert once, twice. So I'm
          > getting double the records inserted into the database than I want.
          >
          > I checked the IIS logs, and I see three requests for the page with the
          > following status codes: 401.5, 401.1 then 200. I use the CGI username to log
          > the user in, because that way the user doesn't have to type in their username
          > and password everytime they log in. So what I'm getting from those status
          > codes is that the page is trying to get the CGI variables, it fails, then it
          > gives the generic login failed status, then it finally gets the user's info and
          > logs them in correctly.

          Aaron,

          You're doing the HTTP Authentication at the IIS level or at the CF level
          ? (from the description of your problem it seems you're doing it at the
          CF level - generating a a 401 response code with CFHEADER)

          --
          Mack
          • 2. Re: CGI problem
            aaronsven Level 1
            I'm doing it at the CF level but I had to do this to get the the CGI variables to populate:

            <cfif cgi.http_authorization is "">
            <cfheader statuscode="401" statustext="">
            <cfheader name="Www-Authenticate" value="NTLM">
            </cfif>
            .
            Otherwise the cgi variable doesn't assign the cgi.auth_user property.
            • 3. Re: CGI problem
              Level 7
              aaronsven wrote:
              > I'm doing it at the CF level but I had to do this to get the the CGI variables
              > to populate:
              >
              > <cfif cgi.http_authorization is "">
              > <cfheader statuscode="401" statustext="">
              > <cfheader name="Www-Authenticate" value="NTLM">
              > </cfif>
              > .
              > Otherwise the cgi variable doesn't assign the cgi.auth_user property.

              CFABORT after you send the tags.

              --
              Mack
              • 4. Re: CGI problem
                Level 7
                Mack wrote:
                > aaronsven wrote:
                >> I'm doing it at the CF level but I had to do this to get the the CGI variables
                >> to populate:
                >>
                >> <cfif cgi.http_authorization is "">
                >> <cfheader statuscode="401" statustext="">
                >> <cfheader name="Www-Authenticate" value="NTLM">
                >> </cfif>
                >> .
                >> Otherwise the cgi variable doesn't assign the cgi.auth_user property.
                >
                > CFABORT after you send the tags.

                I meant: CFABORT after you send the headers.

                Sorry for the mistake.

                --
                Mack
                • 5. Re: CGI problem
                  aaronsven Level 1
                  So you mean I should do something like this?

                  <cfheader statuscode="401" statustext="">
                  <cfheader name="Www-Authenticate" value="NTLM">
                  <cfabort>

                  That doesn't seem to work either, it still makes 3 requests for the page before it allows it to log on.
                  • 6. Re: CGI problem
                    Level 7
                    aaronsven wrote:
                    > So you mean I should do something like this?
                    >
                    > <cfheader statuscode="401" statustext="">
                    > <cfheader name="Www-Authenticate" value="NTLM">
                    > <cfabort>
                    >
                    > That doesn't seem to work either, it still makes 3 requests for the page
                    > before it allows it to log on.

                    Yes, but you need to place this code at the top of your pages so you
                    don't execute the rest of the page for the initial 401, only this code.

                    --
                    Mack