Can not get URL using GetPageContext().getRequest().getRequestURI()

Copy link to clipboard
Copied
Hi guys,
I am coding a web application using ColdFusion 8.
The situation is as follow:
- I type https://mypage.com/aaa/bbb.html on web browser where aaa and bbb.html does not exist in my web folder.
- And this will drive the error 404 PageNotFound occurred, in the code that processing error 404, I tried to get URL aaa/bbb.html by using GetPageContext().getRequest().getRequestURI() but the result of this command is my created 404 error page.
- I also tried to get URL by using CGI, but also couldn't get it.
Can you guys show me the way to get URL when no page is found error occurred?
Thank you very much in advanced!
Copy link to clipboard
Copied
First, please dump the CGI scope using
<cfdump var="#CGI#">
and see what that shows you. Did you also try:
getPageContext().getRequest().getRequestURL()
Copy link to clipboard
Copied
In the CGI scope, there _should_ be a referrer variable that will tell you which page triggered the 404.
^_^
Copy link to clipboard
Copied
No screen wrote:
- I type https://mypage.com/aaa/bbb.html on web browser where aaa and bbb.html does not exist in my web folder.
- And this will drive the error 404 PageNotFound occurred, in the code that processing error 404, I tried to get URL aaa/bbb.html by using GetPageContext().getRequest().getRequestURI() but the result of this command is my created 404 error page.
ColdFusion will know nothing of https://mypage.com/aaa/bbb.html! As the requested page is HTML, the web server will respond to it, without involving ColdFusion. The ColdFusion function GetPageContext() is therefore irrelevant.

