• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CGI problem

New Here ,
Mar 25, 2009 Mar 25, 2009

Copy link to clipboard

Copied

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
TOPICS
Advanced techniques

Views

832

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2009 Mar 25, 2009

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2009 Mar 25, 2009

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2009 Mar 26, 2009

Copy link to clipboard

Copied

LATEST
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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation