coldfusioncoldfusion-11application.cfc

Coldfusion onRequestStart show some error


I try to write a onRequestStart function in application.cfc and code is

 function onRequestStart(requestname){ 
    if(!structKeyExists(session, "UserId") or !structKeyExists(session, "LoggedIn") ){
        if(!(find("login",requestname) > 0 or find("signup",requestname) > 0)){
           location("/mobile/index.cfm",false);
        }
    }else{
            location("/mobile/dashbord.cfm",false);
    }
}

the above code if condition is working ,after login the else condition will show This page isn’t working127.0.0.1 redirected you too many times. this error. why show this error , i am new in coldfusion please help me to solve this issue.


Solution

  • You are trying to locate the dashbord from dashbord page, Incase you are hitting the page like this and it will show the issue of redirected you too many times , so you need to put some condition in else statement like below,

    !find("dashbord",requestname) > 0