Avatar of erikTsomik
erikTsomik
Flag for United States of America asked on

You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members. in Coldfusion

I am getting the following error
You have attempted to dereference a scalar variable of type class java.lang.String as a structure with members.  And it points me to the following line of my code :  <cfset StructAppend(SESSION, data)>
The below is my script

<cfcomponent displayname="login2" extends="tool">
<cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="CompanyID" required="true" type="numeric">            
            <cfargument name="webid" required="false" default="0">
            <cfargument name="datatype" required="false" default="0">
            
            <cfset super.init(CompanyID, arguments.webID, arguments.datatype)>
             <!--- create objects --->
            <cfset this.navigation = createObject("component", "hb50.navigation").init(CompanyID)>
            <cfset this.workflow = createObject("component", "hb50.workflow").init(CompanyID)>
            <cfset this.display = createObject("component", "hb50.display").init(CompanyID)>
            <cfset this.media = createObject("component", "hb50.media").init(this.CompanyID)>
            <cfset this.blnContent = true>
            
            <cfscript>
                  this.homeData = newFormData();
                  this.homeData.tablename = "tblExtranetOptions";
                  this.homeData.title = "Extranet Login Options";
                  columns = ArrayNew(1);
                  
                  xmlNav = this.navigation.getPublicNavXML();
                  x = StructNew();
                  x.varname = "optDefaultPage";
                  x.title = "Extranet Logged In Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = true;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "optLoggedOutDefaultPage";
                  x.title = "Extranet Logged Out Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = false;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "blnLDAP";
                  x.title = "Use LDAP for Authentication";
                  x.type = TYPES.BOOLEAN;
                  x.required = false;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtForgotPass";
                  x.title = "Forgot Password";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtSuccessEmail";
                  x.title = "Password Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtUnSuccessEmail";
                  x.title = "Password Not Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);

                  x = StructNew();
                  x.varname = "txtLoginMessage";
                  x.title = "Login";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "intRoleID";
                  x.title = "RoleId";
                  x.type = TYPES.NUMBER;
                  x.required = false;
                  ArrayAppend(columns, x);
                  
                  
                  this.homeData.columns = columns;
                  this.homeData.webid = this.webid;
                  this.homeData.blnWorkflow = false;
                  this.homeData.blnApproval = false;
                  this.homeData.blnLock = false;
                  this.homeData.blnVersion = false;
                  this.homeData.blnDelete = false;
                  this.homeData.blnPreview = false;
                  this.homeData.blnCategory = false;                  
                  this.homeData.blnScheduling = false;                  
                  this.homeData.blnMeta = true;                  
                  this.homeData.blnResources = false;
                  this.homeData.link = this.link;
                  this.homeData.varID = "intID";
                  return this;
            </cfscript>
      </cffunction>
      
      <cffunction name="getTabs" access="public" returntype="any">
            <cfxml variable="xmlNav">
                  <cfoutput>
                        <item>
                              <item caption="Login Options" id="1"/>
                        </item>
                  </cfoutput>
            </cfxml>
            <cfreturn xmlNav />
      </cffunction>
      
      <cffunction name="getBackEnd" access="public" returntype="string">
            <cfset this.workflow.verifyColumns(this.homeData)>
            <!--- process the form in the back end and inserted --->
            <cfset this.display.setActionMsg(this.workflow.processForm(this.homeData))>
            <!--- this actually get the record (only 1) and you continually edit the record after the first time --->
            <cfquery name="qryExtranetOptions" datasource="#this.datasource#">
                  SELECT *
                  FROM tblExtranetOptions
                  WHERE intCompanyID = #this.companyID#
            </cfquery>
            <cfif qryExtranetOptions.recordcount>
                  <cfset url.id = qryExtranetOptions.intID>
            </cfif>
            <cfset this.homeData.tabs[1] = StructNew()>
            <cfset this.homeData.tabs[1].caption = 'Default Pages'>
            <cfset this.homeData.tabs[1].columnlist = 'optDefaultPage,optLoggedOutDefaultPage,blnLDAP'>
            <cfset this.homeData.tabs[2] = StructNew()>
            <cfset this.homeData.tabs[2].caption = 'Login'>
            <cfset this.homeData.tabs[2].columnlist = 'txtLoginMessage'>
            <cfset this.homeData.tabs[3] = StructNew()>
            <cfset this.homeData.tabs[3].caption = 'Emailed'>
            <cfset this.homeData.tabs[3].columnlist = 'txtSuccessEmail'>
            <cfset this.homeData.tabs[4] = StructNew()>      `
            <cfset this.homeData.tabs[4].caption = 'Not Emailed'>
            <cfset this.homeData.tabs[4].columnlist = 'txtUnSuccessEmail'>
            <cfset this.homeData.tabs[5] = StructNew()>
            <cfset this.homeData.tabs[5].caption = 'Forgot'>
            <cfset this.homeData.tabs[5].columnlist = 'txtForgotPass'>
            
            <!--- when user clicks save, update all the blnldap settings for this company --->
            <cfif isDefined("form.button") AND FORM.button eq #translate('Save')#>
                  <cfset ldap = 0>
                  <cfif isDefined("form.BLNLDAP") AND FORM.BLNLDAP eq 'on'>
                        <cfset ldap = 1>
                  </cfif>

                  <cfquery name="qryUpdateLdap" datasource="#this.datasource#">
                        UPDATE tblExtranetOptions
                        SET blnLDAP = #ldap#                  
                        WHERE intCompanyID = #this.companyID#
                  </cfquery>
            </cfif>
            <cfreturn this.display.getAddEdit(this.homeData)>
      </cffunction>

      <cffunction name="DisplayLoginForm" access="public" returntype="string" output="false">
      
            <cfsavecontent variable="txtOutput">
                  <cfoutput>
                  <div id="test">
                        <form   method="post"  name="form">
                              <b><i>User Name: </i></b><input type="text" name="txtUserName" size="20"><br />
                               <b><i>Password: </i></b><input type="password" name="txtPassword" size="20"><br />
                               <input type="submit" value="Login >>>" name="Login" >
                        </form>
                        </div>
                  </cfoutput>
            </cfsavecontent>
            
            <cfreturn txtOutput />      
      </cffunction>
      
      
      <cffunction name="getFrontEnd" access="public" returntype="struct" hint="Returns front end display.">
            <cfset var strFrontEnd = StructNew()>
            <cfset strFrontEnd.title = "">
            <cfset strFrontEnd.body = "">
            
            <cfquery name="qryOptions" datasource="#this.datasource#">
                  SELECT       optDefaultPage, txtLoginMessage, txtForgotPass, txtSuccessEmail, txtUnSuccessEmail,      optLoggedOutDefaultPage
                  FROM       tblExtranetOptions
                  WHERE       intCompanyID = #this.companyId#
            </cfquery>
            
            
            <cfset strFrontEnd.body = DisplayLoginForm()>
            
            
            <!---check if the user is authenticated--->
            <cfif isDefined ("form.txtUserName") and isDefined ("form.txtPassword")>
                  <cfset admin = createObject('component', 'hb50.ldap').init(this.companyId)>
            <cftry>
                  <cfset data = admin.login(#FORM.txtUsername#, #FORM.txtPassword#)>
                  <cfset StructAppend(SESSION, data)>
                  <cfcatch type="user">
                  
                        <cfset loginError = true>
                        <cfset loginErrorText = CFCATCH.message>
                        
                  </cfcatch>
            </cftry>
                  </cfif>
                  <cfoutput> <cfdump var="SESSION"></cfoutput>
                  <cfif isDefined("URL.navid")>
                  
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
                  
                  <!---<cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
            <!---<cfinclude template="test.cfm">--->
            <cfabort />
      </cfif>
      <cfif isDefined("URL.navid")>
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
            <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
            
                  <cfset xmlNav = this.navigation.getPublicNavXML()>
                  <cfset xmlResult = searchXMLByID(xmlNav, defPage)>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = qryOptions.optDefaultPage>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                        
                                          
                                    <cflocation url="#txtRedirectLink#" addtoken="no">                              
                              </cfif>
            </cfif>
            </cfif>--->
            
            <cfreturn strFrontEnd />
      </cffunction>
      
</cfcomponent>



Web ServersWeb DevelopmentProgramming Languages-Other

Avatar of undefined
Last Comment
_agx_

8/22/2022 - Mon
_agx_

>> <cfset data = admin.login(#FORM.txtUsername#, #FORM.txtPassword#)>
>> <cfset StructAppend(SESSION, data)>

StructureAppend "Appends one structure to another".  From the error message, it sounds like "data" is not a structure.  What type of value does the admin.login(...) function return?

If what you want is to create a new session variable named "data" you could do this
<cfset SESSION["data"] = data /> .... or
<cfset SESSION.data = data />
erikTsomik

ASKER
It seems to be working. But the question is why is not redirecting \

<cfcomponent displayname="login2" extends="tool">
<cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="CompanyID" required="true" type="numeric">            
            <cfargument name="webid" required="false" default="0">
            <cfargument name="datatype" required="false" default="0">
            
            <cfset super.init(CompanyID, arguments.webID, arguments.datatype)>
             <!--- create objects --->
            <cfset this.navigation = createObject("component", "hb50.navigation").init(CompanyID)>
            <cfset this.workflow = createObject("component", "hb50.workflow").init(CompanyID)>
            <cfset this.display = createObject("component", "hb50.display").init(CompanyID)>
            <cfset this.media = createObject("component", "hb50.media").init(this.CompanyID)>
            <cfset this.blnContent = true>
            
            <cfscript>
                  this.homeData = newFormData();
                  this.homeData.tablename = "tblExtranetOptions";
                  this.homeData.title = "Extranet Login Options";
                  columns = ArrayNew(1);
                  
                  xmlNav = this.navigation.getPublicNavXML();
                  x = StructNew();
                  x.varname = "optDefaultPage";
                  x.title = "Extranet Logged In Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = true;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "optLoggedOutDefaultPage";
                  x.title = "Extranet Logged Out Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = false;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "blnLDAP";
                  x.title = "Use LDAP for Authentication";
                  x.type = TYPES.BOOLEAN;
                  x.required = false;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtForgotPass";
                  x.title = "Forgot Password";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtSuccessEmail";
                  x.title = "Password Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "txtUnSuccessEmail";
                  x.title = "Password Not Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);

                  x = StructNew();
                  x.varname = "txtLoginMessage";
                  x.title = "Login";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                  
                  x = StructNew();
                  x.varname = "intRoleID";
                  x.title = "RoleId";
                  x.type = TYPES.NUMBER;
                  x.required = false;
                  ArrayAppend(columns, x);
                  
                  
                  this.homeData.columns = columns;
                  this.homeData.webid = this.webid;
                  this.homeData.blnWorkflow = false;
                  this.homeData.blnApproval = false;
                  this.homeData.blnLock = false;
                  this.homeData.blnVersion = false;
                  this.homeData.blnDelete = false;
                  this.homeData.blnPreview = false;
                  this.homeData.blnCategory = false;                  
                  this.homeData.blnScheduling = false;                  
                  this.homeData.blnMeta = true;                  
                  this.homeData.blnResources = false;
                  this.homeData.link = this.link;
                  this.homeData.varID = "intID";
                  return this;
            </cfscript>
      </cffunction>
      
      <cffunction name="getTabs" access="public" returntype="any">
            <cfxml variable="xmlNav">
                  <cfoutput>
                        <item>
                              <item caption="Login Options" id="1"/>
                        </item>
                  </cfoutput>
            </cfxml>
            <cfreturn xmlNav />
      </cffunction>
      
      <cffunction name="getBackEnd" access="public" returntype="string">
            <cfset this.workflow.verifyColumns(this.homeData)>
            <!--- process the form in the back end and inserted --->
            <cfset this.display.setActionMsg(this.workflow.processForm(this.homeData))>
            <!--- this actually get the record (only 1) and you continually edit the record after the first time --->
            <cfquery name="qryExtranetOptions" datasource="#this.datasource#">
                  SELECT *
                  FROM tblExtranetOptions
                  WHERE intCompanyID = #this.companyID#
            </cfquery>
            <cfif qryExtranetOptions.recordcount>
                  <cfset url.id = qryExtranetOptions.intID>
            </cfif>
            <cfset this.homeData.tabs[1] = StructNew()>
            <cfset this.homeData.tabs[1].caption = 'Default Pages'>
            <cfset this.homeData.tabs[1].columnlist = 'optDefaultPage,optLoggedOutDefaultPage,blnLDAP'>
            <cfset this.homeData.tabs[2] = StructNew()>
            <cfset this.homeData.tabs[2].caption = 'Login'>
            <cfset this.homeData.tabs[2].columnlist = 'txtLoginMessage'>
            <cfset this.homeData.tabs[3] = StructNew()>
            <cfset this.homeData.tabs[3].caption = 'Emailed'>
            <cfset this.homeData.tabs[3].columnlist = 'txtSuccessEmail'>
            <cfset this.homeData.tabs[4] = StructNew()>      `
            <cfset this.homeData.tabs[4].caption = 'Not Emailed'>
            <cfset this.homeData.tabs[4].columnlist = 'txtUnSuccessEmail'>
            <cfset this.homeData.tabs[5] = StructNew()>
            <cfset this.homeData.tabs[5].caption = 'Forgot'>
            <cfset this.homeData.tabs[5].columnlist = 'txtForgotPass'>
            
            <!--- when user clicks save, update all the blnldap settings for this company --->
            <cfif isDefined("form.button") AND FORM.button eq #translate('Save')#>
                  <cfset ldap = 0>
                  <cfif isDefined("form.BLNLDAP") AND FORM.BLNLDAP eq 'on'>
                        <cfset ldap = 1>
                  </cfif>

                  <cfquery name="qryUpdateLdap" datasource="#this.datasource#">
                        UPDATE tblExtranetOptions
                        SET blnLDAP = #ldap#                  
                        WHERE intCompanyID = #this.companyID#
                  </cfquery>
            </cfif>
            <cfreturn this.display.getAddEdit(this.homeData)>
      </cffunction>

      <cffunction name="DisplayLoginForm" access="public" returntype="string" output="false">
      
            <cfsavecontent variable="txtOutput">
                  <cfoutput>
                  <div id="test">
                        <form   method="post"  name="form">
                              <b><i>User Name: </i></b><input type="text" name="txtUserName" size="20"><br />
                               <b><i>Password: </i></b><input type="password" name="txtPassword" size="20"><br />
                               <input type="submit" value="Login >>>" name="Login" >
                        </form>
                        </div>
                  </cfoutput>
            </cfsavecontent>
            
            <cfreturn txtOutput />      
      </cffunction>
      
      
      <cffunction name="getFrontEnd" access="public" returntype="struct" hint="Returns front end display.">
            <cfset var strFrontEnd = StructNew()>
            <cfset strFrontEnd.title = "">
            <cfset strFrontEnd.body = "">
            <cfscript>
            
            
            var foundOne=false;
            
            </cfscript>
            
            <cfquery name="qryOptions" datasource="#this.datasource#">
                  SELECT       optDefaultPage, txtLoginMessage, txtForgotPass, txtSuccessEmail, txtUnSuccessEmail,      optLoggedOutDefaultPage
                  FROM       tblExtranetOptions
                  WHERE       intCompanyID = #this.companyId#
            </cfquery>
            
            
            <cfset strFrontEnd.body = DisplayLoginForm()>
            
            
            <!---check if the user is authenticated--->
            <cfif isDefined("application.ldap") and application.ldap>
            <cfif isDefined ("form.txtUserName") and isDefined ("form.txtPassword")>
                  <cfset admin = createObject('component', 'hb50.ldap').init(this.companyId)>
            <cftry>
                  <cfset data = admin.login(#FORM.txtUsername#, #FORM.txtPassword#)>
                  <cfset StructAppend(SESSION, data)>
                  <cfcatch type="user">
                  
                        <cfset loginError = true>
                        <cfset loginErrorText = CFCATCH.message>
                        
                  </cfcatch>
            </cftry>
                  </cfif>
                  
      
                  
                  <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
            <cfinclude template="test.cfm">
            <cfabort />
      </cfif>
            

      <cfif isDefined("URL.navid")>
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
            <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
            
                  <cfset xmlNav = this.navigation.getPublicNavXML()>
                  <cfset xmlResult = searchXMLByID(xmlNav, defPage)>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = qryOptions.optDefaultPage>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                        
                                          
                                    <cflocation url="#txtRedirectLink#" addtoken="no">                              
                              </cfif>
            </cfif>
            </cfif>
            
            <cfreturn strFrontEnd />
      </cffunction>
      
</cfcomponent>
_agx_

You have several cfif statements before the cflocation.  Maybe its never reaching that section of code. Add some debug statements to the code to see if its even reaching the cflocation statement.  

You may need to change the output attribute for your component/functions: output="yes"

<cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
 DEBUGGING -  inside CFIF statement 1..<br/>
                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
           
                  <cfset xmlNav = this.navigation.getPublicNavXML()>
                  <cfset xmlResult = searchXMLByID(xmlNav, defPage)>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
DEBUGGING -  inside CFIF statement 2..<br/>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = qryOptions.optDefaultPage>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                        
DEBUGGING -  inside CFIF statement 3..<br/>
DEBUGGING -  txtRedirectLink..= <cfoutput>#txtRedirectLink#</cfoutput><br/>
                                         
                                    <cflocation url="#txtRedirectLink#" addtoken="no">                              
                              </cfif>
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
erikTsomik

ASKER
I have entered this piece of code but it does not stop execution whenever the messages are. I do not really know what to do next. I am stock
_agx_

Are you saying it does or does not print the messages? If its not printing anything, did you make sure you enabled output in the component / function(s) ?  In other words

<cffunction name="blahblah" OUTPUT="yes">
...
</cffunction>
erikTsomik

ASKER
I have enabled the output but still can not see it
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

You may have to do it in multiple places.  Try putting a statement just inside the function you're trying to call.

 <cffunction name="getFrontEnd" access="public" returntype="struct" hint="Returns front end display.">
DEBUGGING - INSIDE getFrontEnd
erikTsomik

ASKER
OK what happening know is I am gettin redirected all the time probably because I am never get logout. But it redirecting me to page which does not exest because the redirect link is number insted of being a string http://olympus.scs.jhu.edu/testLogin/test4/1814. The id (1814) is correct but it supposed to be test1.cfm

<cfcomponent displayname="login2" extends="tool">
<cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="CompanyID" required="true" type="numeric">            
            <cfargument name="webid" required="false" default="0">
            <cfargument name="datatype" required="false" default="0">
           
            <cfset super.init(CompanyID, arguments.webID, arguments.datatype)>
             <!--- create objects --->
            <cfset this.navigation = createObject("component", "hb50.navigation").init(CompanyID)>
            <cfset this.workflow = createObject("component", "hb50.workflow").init(CompanyID)>
            <cfset this.display = createObject("component", "hb50.display").init(CompanyID)>
            <cfset this.media = createObject("component", "hb50.media").init(this.CompanyID)>
            <cfset this.blnContent = true>
           
            <cfscript>
                  this.homeData = newFormData();
                  this.homeData.tablename = "tblExtranetOptions";
                  this.homeData.title = "Extranet Login Options";
                  columns = ArrayNew(1);
                 
                  xmlNav = this.navigation.getPublicNavXML();
                  x = StructNew();
                  x.varname = "optDefaultPage";
                  x.title = "Extranet Logged In Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = true;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "optLoggedOutDefaultPage";
                  x.title = "Extranet Logged Out Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = false;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "blnLDAP";
                  x.title = "Use LDAP for Authentication";
                  x.type = TYPES.BOOLEAN;
                  x.required = false;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "txtForgotPass";
                  x.title = "Forgot Password";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "txtSuccessEmail";
                  x.title = "Password Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "txtUnSuccessEmail";
                  x.title = "Password Not Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);

                  x = StructNew();
                  x.varname = "txtLoginMessage";
                  x.title = "Login";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "intRoleID";
                  x.title = "RoleId";
                  x.type = TYPES.NUMBER;
                  x.required = false;
                  ArrayAppend(columns, x);
                 
                 
                  this.homeData.columns = columns;
                  this.homeData.webid = this.webid;
                  this.homeData.blnWorkflow = false;
                  this.homeData.blnApproval = false;
                  this.homeData.blnLock = false;
                  this.homeData.blnVersion = false;
                  this.homeData.blnDelete = false;
                  this.homeData.blnPreview = false;
                  this.homeData.blnCategory = false;                  
                  this.homeData.blnScheduling = false;                  
                  this.homeData.blnMeta = true;                  
                  this.homeData.blnResources = false;
                  this.homeData.link = this.link;
                  this.homeData.varID = "intID";
                  return this;
            </cfscript>
      </cffunction>
     
      <cffunction name="getTabs" access="public" returntype="any">
            <cfxml variable="xmlNav">
                  <cfoutput>
                        <item>
                              <item caption="Login Options" id="1"/>
                        </item>
                  </cfoutput>
            </cfxml>
            <cfreturn xmlNav />
      </cffunction>
     
      <cffunction name="getBackEnd" access="public" returntype="string">
            <cfset this.workflow.verifyColumns(this.homeData)>
            <!--- process the form in the back end and inserted --->
            <cfset this.display.setActionMsg(this.workflow.processForm(this.homeData))>
            <!--- this actually get the record (only 1) and you continually edit the record after the first time --->
            <cfquery name="qryExtranetOptions" datasource="#this.datasource#">
                  SELECT *
                  FROM tblExtranetOptions
                  WHERE intCompanyID = #this.companyID#
            </cfquery>
            <cfif qryExtranetOptions.recordcount>
                  <cfset url.id = qryExtranetOptions.intID>
            </cfif>
            <cfset this.homeData.tabs[1] = StructNew()>
            <cfset this.homeData.tabs[1].caption = 'Default Pages'>
            <cfset this.homeData.tabs[1].columnlist = 'optDefaultPage,optLoggedOutDefaultPage,blnLDAP'>
            <cfset this.homeData.tabs[2] = StructNew()>
            <cfset this.homeData.tabs[2].caption = 'Login'>
            <cfset this.homeData.tabs[2].columnlist = 'txtLoginMessage'>
            <cfset this.homeData.tabs[3] = StructNew()>
            <cfset this.homeData.tabs[3].caption = 'Emailed'>
            <cfset this.homeData.tabs[3].columnlist = 'txtSuccessEmail'>
            <cfset this.homeData.tabs[4] = StructNew()>      `
            <cfset this.homeData.tabs[4].caption = 'Not Emailed'>
            <cfset this.homeData.tabs[4].columnlist = 'txtUnSuccessEmail'>
            <cfset this.homeData.tabs[5] = StructNew()>
            <cfset this.homeData.tabs[5].caption = 'Forgot'>
            <cfset this.homeData.tabs[5].columnlist = 'txtForgotPass'>
           
            <!--- when user clicks save, update all the blnldap settings for this company --->
            <cfif isDefined("form.button") AND FORM.button eq #translate('Save')#>
                  <cfset ldap = 0>
                  <cfif isDefined("form.BLNLDAP") AND FORM.BLNLDAP eq 'on'>
                        <cfset ldap = 1>
                  </cfif>

                  <cfquery name="qryUpdateLdap" datasource="#this.datasource#">
                        UPDATE tblExtranetOptions
                        SET blnLDAP = #ldap#                  
                        WHERE intCompanyID = #this.companyID#
                  </cfquery>
            </cfif>
            <cfreturn this.display.getAddEdit(this.homeData)>
      </cffunction>

      <cffunction name="DisplayLoginForm" access="public" returntype="string" output="false">
     
            <cfsavecontent variable="txtOutput">
                  <cfoutput>
                  <div id="test">
                        <form   method="post"  name="form">
                              <b><i>User Name: </i></b><input type="text" name="txtUserName" size="20"><br />
                               <b><i>Password: </i></b><input type="password" name="txtPassword" size="20"><br />
                               <input type="submit" value="Login >>>" name="Login" >
                        </form>
                        </div>
                  </cfoutput>
            </cfsavecontent>
           
            <cfreturn txtOutput />      
      </cffunction>
     
     
      <cffunction name="getFrontEnd" access="public" returntype="struct" hint="Returns front end display." output="true">
            <cfset var strFrontEnd = StructNew()>
            <cfset strFrontEnd.title = "">
            <cfset strFrontEnd.body = "">
   
            <cfquery name="qryOptions" datasource="#this.datasource#">
                  SELECT       optDefaultPage, txtLoginMessage, txtForgotPass, txtSuccessEmail, txtUnSuccessEmail,      optLoggedOutDefaultPage
                  FROM       tblExtranetOptions
                  WHERE       intCompanyID = #this.companyId#
            </cfquery>
           
           
            <cfset strFrontEnd.body = DisplayLoginForm()>
           
           
            <!---check if the user is authenticated--->
         <cfsetting enablecfoutputonly="yes">
            <cfif isDefined ("form.txtUserName") and isDefined ("form.txtPassword")>
                  <cfset admin = createObject('component', 'hb50.ldap').init(this.companyId)>
            <cftry>
                  <cfset data = admin.login(FORM.txtUsername, FORM.txtPassword)>
                 <!--- <cfset StructAppend(SESSION, data)>--->
                         <cfset SESSION.data=data />
                         
                  <cfcatch type="user">
                 
                        <cfset loginError = true>
                        <cfset loginErrorText = CFCATCH.message>
                       
                  </cfcatch>
            </cftry>
                  </cfif>
                 
     
                 
                <!---  <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
            <cfinclude template="test.cfm">
            <cfabort />
      </cfif>--->
           

      <cfif isDefined("URL.navid")>
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
            <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>
 DEBUGGING -  inside CFIF statement 1..<br/>
                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
           
                  <cfset xmlNav = this.navigation.getPublicNavXML()>
                  <cfset xmlResult = searchXMLByID(xmlNav, defPage)>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
DEBUGGING -  inside CFIF statement 2..<br/>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = qryOptions.optDefaultPage>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                        
DEBUGGING -  inside CFIF statement 3..<br/>
DEBUGGING -  txtRedirectLink..= <cfoutput>#txtRedirectLink#</cfoutput><br/>
                                         
                                    <cflocation url="#txtRedirectLink#" addtoken="no">      
                                                      <cfdump var="#txtRedirectLink#"   >                     
                              </cfif>
            </cfif>
            </cfif>
           
            <cfreturn strFrontEnd />
      </cffunction>
     
</cfcomponent>

_agx_

In the function, you're setting the link to: qryOptions.optDefaultPage

<cfset txtRedirectLink = qryOptions.optDefaultPage>

If "optDefaultPage" is a number, you need to change your query to return the page name AS "optDefaultPage"

<cfquery name="qryOptions" datasource="#this.datasource#">
                  SELECT       optDefaultPage, txtLoginMessage, txtForgotPass, txtSuccessEmail, txtUnSuccessEmail,      optLoggedOutDefaultPage
                  FROM       tblExtranetOptions
                  WHERE       intCompanyID = #this.companyId#
            </cfquery>
Your help has saved me hundreds of hours of internet surfing.
fblack61
erikTsomik

ASKER
Actually this part of the script supposed to handle that
<cfset xmlNav = this.navigation.getPublicNavXML()>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = xmlParent.xmlattributes.url>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                                    
                                    <cflocation url="../#txtRedirectLink#" addtoken="no">                              
                              </cfif>
                        </cfif>
_agx_

That looks different than the previous code.  But it suggests that the value of #xmlParent.xmlattributes.url# is wrong.  If you cfdump it, what is the value? A number or a string (test.cfm)?

erikTsomik

ASKER
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

So if xmlParent.xmlattributes.url is a string, then txtRedirectLink should be a string. So why isn't this working?

<cflocation url="../#txtRedirectLink#" addtoken="no">            
_agx_

Aside from the fact that you don't need to use a relative path if txtRedirectLink is a full url:  
http://olympus.scs.jhu.edu/testLogin/test1/
erikTsomik

ASKER
I do not know. I want to ask the same question. here is the entire script

<cfcomponent displayname="login2" extends="tool">
<cffunction name="init" access="public" returntype="any" output="false">
            <cfargument name="CompanyID" required="true" type="numeric">            
            <cfargument name="webid" required="false" default="0">
            <cfargument name="datatype" required="false" default="0">
           
            <cfset super.init(CompanyID, arguments.webID, arguments.datatype)>
             <!--- create objects --->
            <cfset this.navigation = createObject("component", "hb50.navigation").init(CompanyID)>
            <cfset this.workflow = createObject("component", "hb50.workflow").init(CompanyID)>
            <cfset this.display = createObject("component", "hb50.display").init(CompanyID)>
            <cfset this.media = createObject("component", "hb50.media").init(this.CompanyID)>
            <cfset this.blnContent = true>
           
            <cfscript>
                  this.homeData = newFormData();
                  this.homeData.tablename = "tblExtranetOptions";
                  this.homeData.title = "Extranet Login Options";
                  columns = ArrayNew(1);
                 
                  xmlNav = this.navigation.getPublicNavXML();
                  x = StructNew();
                  x.varname = "optDefaultPage";
                  x.title = "Extranet Logged In Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = true;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "optLoggedOutDefaultPage";
                  x.title = "Extranet Logged Out Default Page";
                  x.type = TYPES.SELECT;
                  x.xml = xmlNav;
                  x.required = false;
                  x.multiple = FALSE;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "blnLDAP";
                  x.title = "Use LDAP for Authentication";
                  x.type = TYPES.BOOLEAN;
                  x.required = false;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "txtForgotPass";
                  x.title = "Forgot Password";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "txtSuccessEmail";
                  x.title = "Password Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "txtUnSuccessEmail";
                  x.title = "Password Not Emailed";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);

                  x = StructNew();
                  x.varname = "txtLoginMessage";
                  x.title = "Login";
                  x.type = TYPES.HTML;
                  x.required = true;
                  ArrayAppend(columns, x);
                 
                  x = StructNew();
                  x.varname = "intRoleID";
                  x.title = "RoleId";
                  x.type = TYPES.NUMBER;
                  x.required = false;
                  ArrayAppend(columns, x);
                 
                 
                  this.homeData.columns = columns;
                  this.homeData.webid = this.webid;
                  this.homeData.blnWorkflow = false;
                  this.homeData.blnApproval = false;
                  this.homeData.blnLock = false;
                  this.homeData.blnVersion = false;
                  this.homeData.blnDelete = false;
                  this.homeData.blnPreview = false;
                  this.homeData.blnCategory = false;                  
                  this.homeData.blnScheduling = false;                  
                  this.homeData.blnMeta = true;                  
                  this.homeData.blnResources = false;
                  this.homeData.link = this.link;
                  this.homeData.varID = "intID";
                  return this;
            </cfscript>
      </cffunction>
     
      <cffunction name="getTabs" access="public" returntype="any">
            <cfxml variable="xmlNav">
                  <cfoutput>
                        <item>
                              <item caption="Login Options" id="1"/>
                        </item>
                  </cfoutput>
            </cfxml>
            <cfreturn xmlNav />
      </cffunction>
     
      <cffunction name="getBackEnd" access="public" returntype="string" output="true">
            <cfset this.workflow.verifyColumns(this.homeData)>
            <!--- process the form in the back end and inserted --->
            <cfset this.display.setActionMsg(this.workflow.processForm(this.homeData))>
            <!--- this actually get the record (only 1) and you continually edit the record after the first time --->
            <cfquery name="qryExtranetOptions" datasource="#this.datasource#">
                  SELECT *
                  FROM tblExtranetOptions
                  WHERE intCompanyID = #this.companyID#
            </cfquery>
            <cfif qryExtranetOptions.recordcount>
                  <cfset url.id = qryExtranetOptions.intID>
            </cfif>
            <cfset this.homeData.tabs[1] = StructNew()>
            <cfset this.homeData.tabs[1].caption = 'Default Pages'>
            <cfset this.homeData.tabs[1].columnlist = 'optDefaultPage,optLoggedOutDefaultPage,blnLDAP'>
            <cfset this.homeData.tabs[2] = StructNew()>
            <cfset this.homeData.tabs[2].caption = 'Login'>
            <cfset this.homeData.tabs[2].columnlist = 'txtLoginMessage'>
            <cfset this.homeData.tabs[3] = StructNew()>
            <cfset this.homeData.tabs[3].caption = 'Emailed'>
            <cfset this.homeData.tabs[3].columnlist = 'txtSuccessEmail'>
            <cfset this.homeData.tabs[4] = StructNew()>      `
            <cfset this.homeData.tabs[4].caption = 'Not Emailed'>
            <cfset this.homeData.tabs[4].columnlist = 'txtUnSuccessEmail'>
            <cfset this.homeData.tabs[5] = StructNew()>
            <cfset this.homeData.tabs[5].caption = 'Forgot'>
            <cfset this.homeData.tabs[5].columnlist = 'txtForgotPass'>
           
            <!--- when user clicks save, update all the blnldap settings for this company --->
            <cfif isDefined("form.button") AND FORM.button eq #translate('Save')#>
                  <cfset ldap = 0>
                  <cfif isDefined("form.BLNLDAP") AND FORM.BLNLDAP eq 'on'>
                        <cfset ldap = 1>
                  </cfif>

                  <cfquery name="qryUpdateLdap" datasource="#this.datasource#">
                        UPDATE tblExtranetOptions
                        SET blnLDAP = #ldap#                  
                        WHERE intCompanyID = #this.companyID#
                  </cfquery>
            </cfif>
            <cfreturn this.display.getAddEdit(this.homeData)>
      </cffunction>

      <cffunction name="DisplayLoginForm" access="public" returntype="string" output="false">
     
            <cfsavecontent variable="txtOutput">
                  <cfoutput>
                  <div id="test">
                        <form   method="post"  name="form">
                              <b><i>User Name: </i></b><input type="text" name="txtUserName" size="20"><br />
                               <b><i>Password: </i></b><input type="password" name="txtPassword" size="20"><br />
                               <input type="submit" value="Login >>>" name="Login" >
                        </form>
                        </div>
                                    
                  
                  </cfoutput>
            </cfsavecontent>
           
            <cfreturn txtOutput />      
      </cffunction>
     
     
      <cffunction name="getFrontEnd" access="public" returntype="struct" hint="Returns front end display." output="true">
            <cfset var strFrontEnd = StructNew()>
            <cfset strFrontEnd.title = "">
            <cfset strFrontEnd.body = "">
   
            <cfquery name="qryOptions" datasource="#this.datasource#">
                  SELECT       a.optDefaultPage, a.txtLoginMessage, a.txtForgotPass, a.txtSuccessEmail, a.txtUnSuccessEmail,      a.optLoggedOutDefaultPage, b.txtDirectory
                  FROM       tblExtranetOptions a inner join tblNavigation b on a.optDefaultPage=b.intID
                  WHERE       a.intCompanyID = #this.companyId#
            </cfquery>
           
           
            <cfset strFrontEnd.body = DisplayLoginForm()>
           
           
            <!---check if the user is authenticated--->
         <cfsetting enablecfoutputonly="yes">
            <cfif isDefined ("form.txtUserName") and isDefined ("form.txtPassword")>
                  <cfset admin = createObject('component', 'hb50.ldap').init(this.companyId)>
                         
            <cftry>
                <cfset data = admin.login(FORM.txtUsername, FORM.txtPassword)>
<!---                 <cfset StructAppend(SESSION, data)>--->
                         <cfset SESSION.data=data />
                              
                  <cfcatch type="user">
                        
                        <cfset loginError = true>
                        <cfset loginErrorText = CFCATCH.message>
                     
                  </cfcatch>
            </cftry>
                  </cfif>
                 
      <cfif isDefined("URL.navid")>
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
           <cfif  (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>

                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
           
                  <cfif isDefined("URL.logout") AND isDefined("SESSION.loggedin") AND NOT SESSION.loggedin AND isDefined("qryOptions.optLoggedOutDefaultPage") AND Val(qryOptions.optLoggedOutDefaultPage)>
                        <cfset xmlNav = this.navigation.getPublicNavXML()>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>
                              <cfset xmlParent = xmlResult[1]>
                              <cfset txtRedirectLink = xmlParent.xmlattributes.url>
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                                    
                                    <cflocation url="#txtRedirectLink#" addtoken="no">                              
                              </cfif>
                        </cfif>
                  </cfif>
                       
                                   
            </cfif>
           
            <cfreturn strFrontEnd />
      </cffunction>
     
</cfcomponent>
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
erikTsomik

ASKER
Here is also the serchXMlById function

<cffunction name="searchXMLByID" access="public" output="false" returntype="any">
            <cfargument name="xml" required="true" type="any">
            <cfargument name="id" required="true" type="numeric">

            <cfset var tick = GetTickCount()>
            <cfset var retval = searchXMLByIDRecursive(arguments.xml.xmlRoot, arguments.id)>
                  
            <cfreturn retval />
      </cffunction>

      <cffunction name="getFileSeparator" access="public" output="false" returntype="any">
            <cfscript>
                  var fileObj = "";
                  
                  if (isDefined("application._fileSeparator"))
                        return application._fileSeparator;
                  else {  
                        if (cgi.CF_TEMPLATE_PATH contains '\')
                              application._fileSeparator = '\';
                        else
                              application._fileSeparator = '/';
            
                        return application._fileSeparator;
                  }
            </cfscript>
      </cffunction>
_agx_

http://olympus.scs.jhu.edu/testLogin/test1/

Now that I look at it, the value doesn't contain a target cfm page, its just a directory.  Maybe you forgot to append the name of a .cfm page onto the url like this?

http://olympus.scs.jhu.edu/testLogin/test1/GOTOTHISPAGE.CFM
erikTsomik

ASKER
And also
      <cffunction name="searchXMLByIDRecursive" access="public" output="false" returntype="any">
            <cfargument name="xml" required="true" type="any">
            <cfargument name="id" required="true" type="numeric">
            
            <cfscript>
                  var i = 1;
                  var children = arguments.xml.xmlchildren;
                  var length = ArrayLen(children);
                  var retval = 0;
                  
                  if (StructKeyExists(arguments.xml.xmlattributes, "id") and arguments.xml.xmlattributes.id is arguments.id)
                        return arguments.xml;
                  
                  for (i=1; i lte length; i = i + 1) {
                        retval = searchXMLByIDRecursive(children[i], arguments.id);
                        if (not isSimpleValue(retval))
                              return retval;
                  }
                  
                  return 0;
            </cfscript>
      </cffunction>
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
_agx_

Is the target url supposed to contain a cfm page like:
http://olympus.scs.jhu.edu/testLogin/test1/GOTOTHISPAGE.CFM

Or is supposed to be just a directory?
http://olympus.scs.jhu.edu/testLogin/test1/

erikTsomik

ASKER
It supposed to a second example http://olympus.scs.jhu.edu/testLogin/test1/
_agx_

I didn't understand your last comment. Is it supposed to contain a cfm page?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
erikTsomik

ASKER
No it should be something like this a http://olympus.scs.jhu.edu/testLogin/test1/
_agx_

---------------------------------------------------------------------------
>>it redirecting me to page which does not exest because the redirect link is number insted of being a >>string http://olympus.scs.jhu.edu/testLogin/test4/1814. The id (1814) is correct but it supposed to be >>test1.cfm"
---------------------------------------------------------------------------

Now I'm a little confused :)  Earlier you said you wanted to redirect to a cfm page like this:
http://olympus.scs.jhu.edu/testLogin/test4/TEST1.CFM 

The URL below points to a *directory* NOT a cfm page
http://olympus.scs.jhu.edu/testLogin/test1/ <<----- Notice there is no ".CFM" page extension

So it seems like something is missing here, and that you're passing the wrong url to cflocation.

erikTsomik

ASKER
Ok .I got the redirection to work. Now the question when I logedIn it keeps my session alive and does not even prompt me with the login screen it automatically redirect me since the session in active. Below is the part of my code that I changed

<cfif isDefined("URL.navid")>
            <cfset URL.navid = Val(URL.navid)>
      </cfif>
           <cfif not (isDefined("SESSION.loggedIn") and SESSION.loggedIn)>

                  <cfparam name="defPage" default="#qryOptions.optDefaultPage#">
                  <cfparam name="loginMsg" default="#qryOptions.txtLoginMessage#">
                  <cfif isDefined("qryOptions") AND qryOptions.recordCount>
                        <cfset defPage = qryOptions.optDefaultPage>
                        <cfset loginMsg = qryOptions.txtLoginMessage>
                  </cfif>
           
                  <cfset xmlNav = this.navigation.getPublicNavXML()>
                                
                  <cfset xmlResult = searchXMLByID(xmlNav, defPage)>
                        <cfset xmlResult = searchXMLByID(xmlNav, qryOptions.optLoggedOutDefaultPage)>
                        <cfif not isSimpleValue(xmlResult)>

                              <cfset xmlParent = xmlResult[1]>
                                <cfset txtRedirectLink = this.navigation.getURL(qryOptions.optLoggedOutDefaultPage) />
                              <cfif xmlParent.xmlattributes.id NEQ this.webid>                        



                                    <cflocation url="#txtRedirectLink#" addtoken="no">      
                                                      <cfdump var="#txtRedirectLink#"   >                     
                              </cfif>
            </cfif>
            </cfif>                                                                                    

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
_agx_

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.