private static void AddHeadersForDelegation(HttpRequest request)
        {
            string targetOrgName = PowerShellRequestFilterModule.GetTargetOrgName(request);

            if (targetOrgName != null)
            {
                request.Headers.Add("msExchTargetTenant", targetOrgName);
            }
            request.Headers.Add("msExchOriginalUrl", request.Url.AbsoluteUri);
        }
        private static void OnBeginRequest(object sender, EventArgs e)
        {
            ExTraceGlobals.DelegatedAuthTracer.TraceFunction <string>(0L, "Enter Function: {0}.", "OnBeginRequest");
            HttpApplication httpApplication = (HttpApplication)sender;
            HttpContext     context         = httpApplication.Context;
            HttpRequest     request         = context.Request;

            PowerShellRequestFilterModule.AddHeadersForDelegation(request);
            ExTraceGlobals.DelegatedAuthTracer.TraceFunction <string>(0L, "Exit Function: {0}.", "OnBeginRequest");
        }