Link to home
Start Free TrialLog in
Avatar of Jay1607

asked on

cfhttp - access response URL parameters

I am using <cfhttp to login to an interface (passing username and password with <cfhttpparam.

I need to access the URL variables (Query String) of the page displayed after login.  In other words.. if I login manually, after logging in, I am displayed a page which has the session id in the query string. I want to access this query string when logging in via <cfhttp.

Does anyone know if/how I can access the QueryString or URL of the page returned from a cfhttp POST request?

Many Thanks

Avatar of _agx_
Flag of United States of America image

My guess - this isn't possible with a cfhttp POST.  If you really needed the functionality, I suspect you'd need a different tool.  It might be possible with java:

If it were a GET request, you'd have options.  (But what login page would use GET? ;-)

May be use can you use TRACE method, insead of "GET" or "POST" method.

Using TRACE method we can get cfide and cftoken from a coldfusion server and you can use those ids to send automated requests to CF server. With cfid and cftoken you get more session details.
That's a good thought.  But I didn't think it works combination with POST.  AFAIK they're mutually exclusive, which might cause a problem.  I'm assuming the redirect only happens when the login is successful.  Meaning the request type would have to be a POST (with those form fields) for there to even be anything to TRACE.
Avatar of Zvonko
Flag of North Macedonia image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yeah, I was thinking about that too.  But I wasn't sure the session would still be valid. Definitely worth trying though, cause I could be wrong.
Avatar of Jay1607


Zvonko, I dropped in redirect="No", and voila!!! there was the location var with the url variable I needed!

Thank you!!
You are welcome <|:-)

So the session value referenced is still valid even though the full login (ie redirect) is canceled?  Never know when I might need this in the future, so want to verify it works as desired.
Avatar of Jay1607


Correct.  It works exactly as needed..
Avatar of Jay1607


Worth pointing out.. I'm not logging into a CF App.. I think it's an old Delphi app..

Great, thanks!

Good point about the app though.  There's probably lots of different handling for sessions.  So it may well vary by platform.