Copy link to clipboard
Copied
Hi,
I have a login page Login.cfm for which I have written code in application.cfc's onRequestStart method,
Copy link to clipboard
Copied
My Login.cfm file is ,
Copy link to clipboard
Copied
First, the difference between CFINCLUDE and CFLOCATION:
So, in your application file, when the 'login.cfm' page loads, the onRequest function fires and sees that this line is TRUE: <cfif cflogin.name IS "" OR cflogin.password IS "">
With that being TRUE, a CFLOCATION will redirect the user, according to your code, back to login.cfm. Now, the same thing will happen. Over and over which is why you get the too many redirects error.
You need to rethink your logic here. Perhaps add an exception for the login page?
Copy link to clipboard
Copied
Hi sdsinc_pmascari, thanks for replying. Add exception for login page means cftry or cfcatch ? Is it possible to write any CFIF logic that will not execute the <cflocation url="login.cfm">
Copy link to clipboard
Copied
Once you find out which CFIF is causing your redirect loop, you could add the following:
AND cgi.script_name NEQ "/yourScriptPath/login.cfm"
Copy link to clipboard
Copied
I added the statement AND cgi.script_name NEQ "/yourScriptPath/login.cfm" in the first cfif ,