When you say new page, do you mean a completely different html page to the login page or are you using just one html file to handle the login and then display the rest of the page after the user has logged in.
If you are using two separate html files and the second file does not check the cookies then there is no possible way it will return to the login page.
The login that I use has has a login page called login.html that contains the following procedure to checlk for a valid user and then set the cookies. At the bottom of the web page I check for vNoLogin and if it is false I then use javascript to change the window.location to the next page eg default.html.
PROCEDURE output-headers:
Delete-Cookie("LoggedIn",?,?).
Delete-Cookie("UserCode",?,?).
Delete-Cookie("LanguageCode",?,?).
IF REQUEST_METHOD = "post" THEN
DO:
FIND UserInformation WHERE UserInformation.UserCode = Get-Value("UserCode")
AND UserInformation.UserPassword = ENCODE(Get-Value("Password"))
NO-LOCK NO-ERROR.
IF AVAILABLE UserInformation THEN
DO:
Set-Cookie("LoggedIn","True", ?, ?, ?, ?, ?).
Set-Cookie("UserCode", Get-Value("UserCode"), ?, ?, ?, ?, ?).
Set-Cookie("LanguageCode", UserInformation.LanguageCode, ?, ?, ?, ?, ?).
END.
ELSE
ASSIGN vNoLogin = True.
END.
END PROCEDURE.
I then have following code in an include file and included it at the top of default.html and every other web page. It checks for the cookie LoggedIn, which confirms that a valid user is logged in. If any of the pages are accessed without logging in first, it redirects to the login page.
PROCEDURE output-headers:
IF Get-Cookie("LoggedIn") <> "True" THEN
DO:
OUTPUT-HTTP-HEADER("Status","302").
OUTPUT-HTTP-HEADER("Location", HOSTURL + APPURL + "~\login.htm").
OUTPUT-HTTP-HEADER("","").
QUIT.
END.
ELSE
IF {&Admin} AND Get-Cookie("UserCode") <> "Admin" THEN
DO:
OUTPUT-HTTP-HEADER("Status","302").
OUTPUT-HTTP-HEADER("Location", HOSTURL + APPURL + "~\denied.htm").
OUTPUT-HTTP-HEADER("","").
QUIT.
END.
END PROCEDURE.