Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

Guest
Apr 29, 2014 Apr 29, 2014

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!

620
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Apr 29, 2014 Apr 29, 2014

First, please dump the CGI scope using

<cfdump var="#CGI#">

and see what that shows you. Did you also try:

getPageContext().getRequest().getRequestURL()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 29, 2014 Apr 29, 2014

In the CGI scope, there _should_ be a referrer variable that will tell you which page triggered the 404.

^_^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 30, 2014 Apr 30, 2014
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources