[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

GetURL from hte request

Posted on 2002-03-09
16
Medium Priority
?
590 Views
Last Modified: 2013-12-24
I need to get the url base exactly as entered in the request that came to the server.
For ex.
If the url was http://localhost/index.cfm I need to get the http://localhost out of it.
I can tokenize it myself to get the base, but I don't know how you get the URL.
I can't use cgi.server_name as it gives me the DNS name  of the host. The user might enter it as a "localhost" or asa a ip_adress and I need to use it the same way, otherwise the session variables will not be avaialble.

Thanks.
0
Comment
Question by:simi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 5
  • +1
16 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 6854547
The only way I know how to get what is in the location part of the browser is using JavaScript.

window.location.hostname

check out:
http://java.areco.cz/manual/objects/location.htm
0
 
LVL 1

Expert Comment

by:dawesi
ID: 6858753
0
 
LVL 1

Expert Comment

by:dawesi
ID: 6858755
0
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

Author Comment

by:simi
ID: 6859011
GCI.Server_name is returning the DNS name of the server.
I don't want this.

Say the DNS name is www.foo.com
I will allways get the www.foo.com as a server name.

But the user can use http://localhost or http://123.123.123.123

I want to be able to reconstruc the URL, using exactly the same server name that the user used.
Otherwise, I can have problems with the Session variables.
That happens also in java Servlets.
So the best way , I found, is to tokenize the server name from the URL typed by the user, and reconstruct the URLs using this  value.
0
 
LVL 1

Expert Comment

by:dawesi
ID: 6859044
Server_Name will return localhost, 127.0.0.1 or whatever you use? I'm not completely sure what you are talking about?

Do you want the server_name to be www.foo.com even if they use 127.0.0.1 or localhost?
0
 
LVL 1

Expert Comment

by:dawesi
ID: 6859431
Answer 1)
Put the tag below in the submitting form:
<INPUT TYPE="hidden" NAME="Request" VALUE="x">
and use:
#ListFirst(GetDirectoryFromPath(Form.Request),'\')#
in your processing page

Answer 2)
Use the http_referer property...
(This will cause issues in IE5.5 and IE6.x)
<CFParam NAME="HTTP_Referer" DEFAULT="">
#ListFirst(GetDirectoryFromPath(HTTP_REFERER),'\')#
0
 

Expert Comment

by:slingle
ID: 6860348
just use cgi.http_host.  it is set to whatever the user enters (without the http) example: if the enter http://localhost/index.cfm, cgi.http_host = localhost, if they enter http://131.107.2.1/index.cfm, cgi.http_host = 127.0.0.1.

I tried to comment to this the other day, but Experts Exchange seemed to be having problems...Isn't that a kicker :-)
0
 

Expert Comment

by:slingle
ID: 6860351
sorry...my above had a mixup...the second example should have had cgi.http_host = 131.107.2.1  Sorry for any mixup.
0
 

Expert Comment

by:slingle
ID: 6860360
sorry...my above had a mixup...the second example should have had cgi.http_host = 131.107.2.1  Sorry for any mixup.
0
 

Author Comment

by:simi
ID: 6861079
The answer came from slingle. I want to assign it the points.

However, I need also to konw where can I find those cgi.xxx
variable names. Nothing in the Cold Fusion help about those.
Like, cgi.server_name, cgi.http_host and so on.

0
 

Author Comment

by:simi
ID: 6861080

0
 

Author Comment

by:simi
ID: 6861083
The answer came from slingle. I want to assign it the points.

However, I need also to konw where can I find those cgi.xxx
variable names. Nothing in the Cold Fusion help about those.
Like, cgi.server_name, cgi.http_host and so on.
0
 
LVL 1

Expert Comment

by:dawesi
ID: 6861173
turn your debug on: they're at the bottom.
0
 

Expert Comment

by:slingle
ID: 6861516
I don't know where it is in the docs.  Like dawesi said, enable debugging for your IP address and they will show up at the bottom.  OR if you have cold fusion 5 you can create a page and throw <cfdump var="cgi"> on it and that will show you the whole cgi. scope.
0
 

Accepted Solution

by:
slingle earned 100 total points
ID: 6861524
just use cgi.http_host.  it is set to whatever the user enters (without the http) example: if the enter
http://localhost/index.cfm, cgi.http_host = localhost, if they enter http://131.107.2.1/index.cfm, cgi.http_host = 131.107.2.1.
0
 

Author Comment

by:simi
ID: 6861544
Thanks.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question