I'm looking for a way to obtain the last page requested in coldfusion. Is there a system value I can access to obtain that information? My end goal is to pass that value into a query for DB insertion.
Asked
Active
Viewed 99 times
1
-
You can use cffile to read your http log. Mind you, if it's a busy site, the file will be big and you might have java heap space issues. – Dan Bracuk May 04 '15 at 16:46
-
What do you mean by "last" in this context? Do you mean the page that resulted in the current request being processed? Or the one previous immediately before the current one? I ask cos I can't see why you'd not log a page request until the *subsequent* request, so asking for the "previous" one doesn't make a great deal of sense to me, based on the info you've provided. – Adam Cameron May 04 '15 at 17:13
-
Long story short: I was asked to track the cfm pages requested. They have over 600 cfm/cfc pages (CF8) and they want to know which ones are still being requested. They want me to run OnRequestEnd.cfm and capture the last page (cfm or cfc) that coldfusion served up, then store that file name in a SQL Server table. – Alex May 04 '15 at 17:27
-
A google search on "analyze http logs" will probably lead you to something useful. – Dan Bracuk May 04 '15 at 18:21
-
1RIght, @Alex, so that would be the *current* request then. And your web server logs all that sort of thing by default, I think. However if that doesn't work, just put a `writeLog()` entry in onRequestStart()` (not `onRequestEnd()`) which logs perhaps `CGI.script_name` or something. But doing it on the web server is a better idea, I reckon. Don't write code for something the system can do *without* writing code. – Adam Cameron May 04 '15 at 21:21
-
I'm aiming to not write code for something I can potentially access through existing channels. I'm just working with a manager who has this legacy CF system with over 1,000 coldfusion and javascript files and they are all stored in one directory. No modular design approach whatsoever, so what I've been handed to fix is very messy and they want all these different custom reports for auditing. – Alex May 05 '15 at 13:31
1 Answers
2
no such system value but I guess you can keep track of it easily by using onRequestStart()
in Application.cfc
and store the requested page name/path in the Server
or Application
scope.

Henry
- 32,689
- 19
- 120
- 221