コード例 #1
0
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            if (this.skipTargetBackEndCalculation)
            {
                base.Logger.Set(HttpProxyMetadata.RoutingHint, "OrgRelationship-Anonymous");
                return(new AnonymousAnchorMailbox(this));
            }
            string text;

            if (ProtocolHelper.IsAutodiscoverV2PreviewRequest(base.ClientRequest.Url.AbsolutePath))
            {
                text = base.ClientRequest.Params["Email"];
            }
            else if (ProtocolHelper.IsAutodiscoverV2Version1Request(base.ClientRequest.Url.AbsolutePath))
            {
                int num = base.ClientRequest.Url.AbsolutePath.LastIndexOf('/');
                text = base.ClientRequest.Url.AbsolutePath.Substring(num + 1);
            }
            else
            {
                text = this.TryGetExplicitLogonNode(ExplicitLogonNode.Second);
            }
            string text2;

            if (ProtocolHelper.TryGetValidNormalizedExplicitLogonAddress(text, out text2))
            {
                this.isExplicitLogonRequest = true;
                this.explicitLogonAddress   = text;
                base.Logger.Set(HttpProxyMetadata.RoutingHint, "ExplicitLogon-SMTP");
                SmtpAnchorMailbox smtpAnchorMailbox = new SmtpAnchorMailbox(text2, this);
                if (this.preferAnchorMailboxHeader)
                {
                    string text3 = base.ClientRequest.Headers[Constants.AnchorMailboxHeaderName];
                    if (!string.IsNullOrEmpty(text3) && !StringComparer.OrdinalIgnoreCase.Equals(text3, text2) && SmtpAddress.IsValidSmtpAddress(text3))
                    {
                        base.Logger.Set(HttpProxyMetadata.RoutingHint, "AnchorMailboxHeader-SMTP");
                        smtpAnchorMailbox = new SmtpAnchorMailbox(text3, this);
                    }
                }
                if (ProtocolHelper.IsAutodiscoverV2Request(base.ClientRequest.Url.AbsolutePath))
                {
                    smtpAnchorMailbox.FailOnDomainNotFound = false;
                }
                return(smtpAnchorMailbox);
            }
            return(base.ResolveAnchorMailbox());
        }