Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread how to ensure HTTPS
Tue, Feb 16 2016 9:16 AMPermanent Link

erickengelke

Avatar

Hi, this is my first contribution BACK to EWS.  If you are passing passwords and the like, you will want to be sure to use HTTPS.   This code will test for HTTPS and convert to HTTPS if not running on the local machine (ie. debugging)



function CheckHTTPS: boolean;
var
 hostname : string;
 protocol : string;
begin
 protocol := LowerCase(window.location.protocol);
 hostname := LowerCase(window.location.hostname);
 result :=  ( hostname = 'localhost') or ( protocol = 'https:');
end;

procedure MakeHTTPS;
var
 s : string;
 hostname, port, search : string;
 pathname , name : string;
begin
 if  not CheckHTTPS then begin
   hostname := window.location.hostname;
   port := window.location.port;
   search := window.location.search;
   pathname := window.location.pathname;

   s := 'https:' + hostname;
   if ( port <> '' ) then s := s + ':'+ port;
   if (pathname <> '') then s := s + '/' + pathname;
   
   window.location.replace( s );
 end;
end;
Thu, Feb 18 2016 11:24 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Erick,

<< Hi, this is my first contribution BACK to EWS.  If you are passing passwords and the like, you will want to be sure to use HTTPS.   This code will test for HTTPS and convert to HTTPS if not running on the local machine (ie. debugging) >>

Nice, thanks. Smile

Tim Young
Elevate Software
www.elevatesoft.com
Image