Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Request.GetRelativeSecureLink problem

$
0
0
Request.GetRelativeSecureLink problem
HTML, CSS, JavaScript, Flash
Request.GetRelativeSecureLink problem
May. 15, 2013
08:15 am
3SA0HPLBCShow this entire thread in new window
Gratar Image based on email address
From:Richard Norris
To:Chris ODonnell
Hi Chris,

The method GetRelativeSecureLink does what it says on the tin, it gets a relative secure link to whatever page you pass it.

Basically you are passing the full URL to this method which is incorrect. The method is already aware of the base URL you are currently in, the idea is you pass a relative URL to the method to get that concatenated to the base URL resulting in your full URL. The WC help explains this quite well. An example of its actual purpose is:

Request.GetRelativeSecureLink("mysubdir/mypage.cfm")

If the URL you were coming from was: http://mywebserver.com/mypath/mypage.cfm
Then the method above would return: http://mywebserver.com/mypath/mysubdir/mypage.cfm

The ultimate purpose is to allow you to type relative links in your script pages and have then output as full URLs in HREFs.

So to be honest you don't need to use this method as it isn't really going to do what you want. The answer is to run this instead:

Response.Redirect(Request.GetCurrentUrl(.T.))

All I've done is removed the redundant GetRelativeSecureLink method and passed .T. to the GetCurrentUrl method. Passing .T. forces the FULL current URL to have HTTPS prefixed instead of HTTP.

I hope this helps.

Regards

Richard


I am using the following to force a redirect to an HTTPS url....

lcPort = Request.ServerVariables("SERVER_PORT") IF lcPort # "443" Response.Redirect( Request.GetRelativeSecureLink(Request.GetCurrentUrl()) )RETURNENDIF

The non-https test URL is something similar to ....

http://www.acme.com/directory1/myMethod.cfm?process=GetAllData&ApiID=8734gTh

The response.redirect above redirects to the following mangled httpS url.

https://www.acme.com/directory1/http://www.acme.com/directory1/myMethod.cfm?process=GetAllData&APIID=8734gTh

Its concatenating the original URL to a piece of the httpS equivalent. Any idea?


Viewing all articles
Browse latest Browse all 10393

Trending Articles