GJ,
I understand what you are trying to say, but I want it to pick up the requested URL, as the user will almost never be going to the same location... I have 3 pages that are protected by this application.cfm, and I want the user to go to whichever they selected once they have logged in.... if they are not logged in currently.
iqof188,
i also tried your method, and I got various errors from CF about how things were not setup correctly (sytax errors) I'll post my entire page so you both can see how it works.
-----Begin Code----- Results.cfm (application.cfm's action file)
<CFSET SESSION.LOGGEDIN = FALSE>
<CFQUERY NAME="CheckUser" DATASOURCE="support" username="search">
SELECT WebUserID, WebPassword
FROM Person
WHERE WebUserID = '#Form.WebUserID#' and WebUSER = '-1'
</CFQUERY>
<!-- Is the user present in the database? -->
<CFIF CHECKUSER.RECORDCOUNT GREATER THAN 0>
<!--- Passwords are not case-sensitive in this application (use Compare() if you want to enable case sensitivity) --->
<CFIF CHECKUSER.WebPASSWORD IS FORM.WebPASSWORD>
<!-- Does the application structure exist? If not, create one -->
<CFIF #ISDEFINED("application.UsersLoggedin"

# IS FALSE>
<CFSET APPLICATION.USERSLOGGEDIN=STRUCTNEW()>
</CFIF>
<CFSET USERIDATDOOR = CHECKUSER.WebUSERID>
<!-- Is there a user already using this login? -->
<CFIF #STRUCTKEYEXISTS(APPLICATION.USERSLOGGEDIN, USERIDATDOOR)# IS TRUE>
<!-- If so, we check if the session is 'virtually' timed out -->
<CFSET ENDTIME = #APPLICATION.USERSLOGGEDIN[USERIDATDOOR].TIMECREATED# + #APPTIMESPAN#>
<CFIF #DATECOMPARE("#Now()#", "#EndTime#"

# IS 1>
<!-- If the application variable is timed out then we delete the user from the structure, to leave some room for the new user -->
<CFOUTPUT>
<CFSCRIPT>
StructDelete(application.UsersLoggedin, #CheckUser.WebUserID#, true);
</CFSCRIPT>
</CFOUTPUT>
<!-- These Session variables are used to control the login validity through the application using the application.cfm -->
<CFSET SESSION.LOGGEDIN = TRUE>
<CFSET SESSION.USERID = CHECKUSER.WebUSERID>
<!-- We then add the current user session structure to the Application structure -->
<CFSET APPLICATION.USERSLOGGEDIN["#session.UserID#"] = SESSION>
<!-- We add a time stamp to determinate the approximate timeout in case of an unexpected departure of the user -->
<CFSET APPLICATION.USERSLOGGEDIN["#Session.UserID#"].TIMECREATED = NOW()>
<CFELSE>
<!-- If the session of the user currently logged in is not over, we display a message -->
<CFOUTPUT>
<CFIF #DATEDIFF("n", "#Now()#", "#EndTime#"

# LT 1>
<CFSET MINUTESLEFT = 'LESS THAN ONE'>
<CFELSE>
<CFSET MINUTESLEFT = #DATEDIFF("n", "#Now()#", "#EndTime#"

#>
</CFIF>
<CFSET REASON = ": \n\n1- User #CheckUser.WebUserID# is already logged in;OR\n2- You have terminated your last session abnormally (e.g., your computer crashed).\n\nThis account will be unlocked #MinutesLeft# minute(s) from now.">
</CFOUTPUT>
</CFIF>
<!-- if we don't detect any user already logged in with the same login, we give the user access to the application -->
<CFELSE>
<!-- These Session variables are used to control the login validity through the application using the application.cfm -->
<CFSET SESSION.LOGGEDIN = TRUE>
<CFSET SESSION.USERID = CHECKUSER.WebUSERID>
<!-- We then add the current user session structure to the Application structure -->
<CFSET APPLICATION.USERSLOGGEDIN["#session.UserID#"] = SESSION>
<!-- We add a time stamp to determinate the approximate timeout in case of an unexpected departure of the user -->
<CFSET APPLICATION.USERSLOGGEDIN["#Session.UserID#"].TIMECREATED = NOW()>
</CFIF>
<!-- if the password was incorrect -->
<CFELSE>
<CFSET REASON = "the Password you typed in is invalid. Please try again">
</CFIF>
<!-- if the username was not present in the database -->
<CFELSE>
<CFOUTPUT>
<CFSET REASON = 'the User Name #FORM.WebUSERID# could not be located.'>
</CFOUTPUT>
</CFIF>
<!-- If the user is authenticated we transfer him/her to the homepage -->
<CFIF SESSION.LOGGEDIN>
<SCRIPT LANGUAGE="JavaScript">
self.location ='support_search.cfm';
</SCRIPT>
<!-- If not we transfer the user to the login page -->
<CFELSE>
<CFOUTPUT>
<SCRIPT>
alert("Sorry! Your login was unsuccessful because #Reason#"

;
self.location="login.cfm";
</SCRIPT>
</CFOUTPUT>
</CFIF>