wwRequest::GetRelativeSecureLink

This method allows you to easily create a secure link simply by specifying a relative link like any other link.

The problem is that switching between HTTP and HTTPS requires a fully qualified URL including protocol, domain name and full Web path, while most sites entirely link with relative links where the protocol and domain name are never used explicitly. It's often difficult to derive the full URL for a secure link especially if the site must be portable and the link cannot be hardcoded with a domain name required to do this.

This method figures out the full current URL converts it to a fully quallified secure link and strips of the document name, then add your link or path at the end. So now to switch you can simply do:

<a href="<%= Request.GetRelativeSecureLink([Somepage.wc]) %>">Secure Page</a>

o.GetRelativeSecureLink(lcLink,llNonSecure)

Return Value

Fully qualified HTTP link based on the currently active URL

Parameters

lcLink
A web server relative link. This path can include relative path information, but should never include a protocol and domainname. If you this method is not useful.

llNonSecure
Optionally you can specify to have the result return a plain HTTP protocol link. This is useful when switching out of secure mode back into the regular site. For example, after you're done after an order on secure site, you probably have a button for 'Shop some more' which returns to the main site in non-secure mode.

Remarks

This method will not work correctly if the current URL does not include a document name, such as home pages. To get around this always reference pages that use this method with an explicit page such as Default.wc.


See also:

Class wwrequest | wwRequest::GetCurrentUrl | wwRequest::GetReferer

© West Wind Technologies, 1996-2018 • Updated: 10/04/15
Comment or report problem with topic