private HttpWebRequest SendRequest(ICredentials credentials)
        {
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(this.url);

            AutoDiscoverClient.AddOutlook14Cookie(httpWebRequest);
            httpWebRequest.Method          = "POST";
            httpWebRequest.ContentType     = "text/xml; charset=utf-8";
            httpWebRequest.Credentials     = credentials;
            httpWebRequest.PreAuthenticate = true;
            httpWebRequest.Headers.Set(HttpRequestHeader.Pragma, "no-cache");
            foreach (string text in this.additionalHeaders.Keys)
            {
                httpWebRequest.Headers.Add(text, this.additionalHeaders[text]);
            }
            httpWebRequest.UserAgent = string.Format("{0}/{1}/{2}", Environment.MachineName, this.componentId, this.emailAddress);
            CertificateValidationManager.SetComponentId(httpWebRequest, this.componentId);
            this.TraceHeaders(httpWebRequest.Headers);
            using (Stream requestStream = httpWebRequest.GetRequestStream())
            {
                SafeXmlSerializer      safeXmlSerializer = new SafeXmlSerializer(typeof(AutoDiscoverRequestXML));
                AutoDiscoverRequestXML o = AutoDiscoverRequestXML.NewRequest(this.emailAddress);
                safeXmlSerializer.Serialize(requestStream, o);
            }
            return(httpWebRequest);
        }
        private HttpWebRequest CreateWebRequest(Uri uri)
        {
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);

            httpWebRequest.UnsafeAuthenticatedConnectionSharing = !this.proxyInfo.RequiresImpersonation;
            if (!this.proxyInfo.RequiresImpersonation)
            {
                httpWebRequest.ServicePoint.ConnectionLimit = GlobalSettings.ProxyConnectionPoolConnectionLimit;
            }
            httpWebRequest.ServicePoint.SetTcpKeepAlive(true, 240000, 5000);
            httpWebRequest.PreAuthenticate   = true;
            httpWebRequest.AllowAutoRedirect = false;
            httpWebRequest.KeepAlive         = !this.proxyInfo.RequiresImpersonation;
            CertificateValidationManager.SetComponentId(httpWebRequest, "AirSync");
            if (this.proxyInfo.CanImpersonate)
            {
                ICredentials defaultCredentials = CredentialCache.DefaultCredentials;
                httpWebRequest.Credentials = defaultCredentials.GetCredential(this.proxyInfo.RemoteUri, "Kerberos");
                if (httpWebRequest.Credentials == null)
                {
                    this.protocolLogger.SetValue(ProtocolLoggerData.Error, "NoKerberosCredentials");
                    throw new AirSyncPermanentException(HttpStatusCode.InternalServerError, StatusCode.ServerError, null, false);
                }
            }
            return(httpWebRequest);
        }
Exemple #3
0
        public virtual async Task SendNotificationsAsync(PusherQueue queueToProcess)
        {
            bool success = false;

            try
            {
                await Task.Delay(TimeSpan.FromMinutes((double)queueToProcess.FailureCount));

                this.IncrementInTransit();
                PusherQueuePayload[] payloads   = queueToProcess.GetPayloads();
                HttpWebRequest       webRequest = (HttpWebRequest)WebRequest.Create(new Uri(queueToProcess.DestinationUrl));
                webRequest.PreAuthenticate = true;
                CertificateValidationManager.SetComponentId(webRequest, "RemoteNotification");
                webRequest.ContentType = "text/plain";
                webRequest.Method      = "POST";
                DateTime pushTime = DateTime.UtcNow;
                await RemoteNotificationRequester.SendRequest(webRequest, RemoteNotificationRequester.GeneratePayload(payloads), queueToProcess.DestinationUrl, payloads.Length);

                await RemoteNotificationRequester.ReceiveResponseAsync(webRequest);

                success = true;
                IEnumerable <NotificationPayloadBase> payloadsToBePushed = from p in payloads
                                                                           select p.Payload;
                NotificationStatisticsManager.Instance.NotificationPushed(queueToProcess.DestinationUrl, payloadsToBePushed, pushTime);
            }
            catch (WebException webException)
            {
                RemoteNotificationRequester.HandleWebException(webException, queueToProcess);
            }
            finally
            {
                queueToProcess.SendComplete(success);
                this.DecrementInTransit();
            }
        }
Exemple #4
0
 private void Application_Start(object sender, EventArgs e)
 {
     Diagnostics.InitializeWatsonReporting();
     if (Globals.InstanceType == InstanceType.NotInitialized)
     {
         string text = HttpProxyGlobals.ProtocolType.ToString();
         text = "FE_" + text;
         Globals.InitializeMultiPerfCounterInstance(text);
     }
     Diagnostics.SendWatsonReportOnUnhandledException(delegate()
     {
         Task.Factory.StartNew(delegate()
         {
             SettingOverrideSync.Instance.Start(true);
         });
         CertificateValidationManager.RegisterCallback(Constants.CertificateValidationComponentId, ProxyApplication.RemoteCertificateValidationCallback);
         ProxyApplication.ConfigureServicePointManager();
         if (DownLevelServerManager.IsApplicable)
         {
             DownLevelServerManager.Instance.Initialize();
         }
     });
     PerfCounters.UpdateHttpProxyPerArrayCounters();
     Diagnostics.Logger.LogEvent(FrontEndHttpProxyEventLogConstants.Tuple_ApplicationStart, null, new object[]
     {
         HttpProxyGlobals.ProtocolType
     });
 }
 internal AutoDiscoverRequest(Application application, ClientContext clientContext, RequestLogger requestLogger, Uri targetUri, EmailAddress emailAddress, ICredentials credentialsForDiscovery, UriSource uriSource) : base(application, clientContext, requestLogger, "AutoDiscoverRequest")
 {
     this.uriSource               = uriSource;
     this.emailAddress            = emailAddress;
     this.credentialsForDiscovery = credentialsForDiscovery;
     this.targetUri               = targetUri;
     CertificateValidationManager.RegisterCallback(Globals.CertificateValidationComponentId, new RemoteCertificateValidationCallback(CertificateErrorHandler.CertValidationCallback));
 }
 public HttpWebResponse AuthenticateAndGetResponse(HttpWebRequest request)
 {
     ArgumentValidator.ThrowIfNull("request", request);
     NetworkServiceImpersonator.Initialize();
     this.tracer.TraceDebug <string>((long)this.GetHashCode(), "LOCAL FOREST OTHER SERVER OUTBOUND AUTHENTICATOR: stamping component id '{0}' onto request.", this.certificateValidationComponentId);
     CertificateValidationManager.SetComponentId(request, this.certificateValidationComponentId);
     request.PreAuthenticate = true;
     return(HttpAuthenticator.NetworkService.AuthenticateAndExecute <HttpWebResponse>(request, () => (HttpWebResponse)request.GetResponse()));
 }
 internal RestService(HttpAuthenticator authenticator, WebServiceUri webServiceUri, bool traceRequest, ITracer upstreamTracer)
 {
     this.authenticator = authenticator;
     this.componentId   = Globals.CertificateValidationComponentId;
     this.httpHeaders   = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
     this.traceRequest  = traceRequest;
     this.tracer        = upstreamTracer;
     this.targetUri     = webServiceUri.Uri;
     CertificateValidationManager.RegisterCallback(this.componentId, new RemoteCertificateValidationCallback(CertificateErrorHandler.CertValidationCallback));
 }
        private static ExchangeService CreateExchangeService(string domain, EncryptionConfigurationTable.RequestData requestData)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            ADUser orgMailbox = EncryptionConfigurationTable.GetOrgMailbox(domain);

            requestData.OrgMailboxAdUserLookupTime = stopwatch.ElapsedMilliseconds;
            if (orgMailbox == null)
            {
                return(null);
            }
            ExchangePrincipal exchangePrincipal;

            try
            {
                exchangePrincipal = ExchangePrincipal.FromADUser(orgMailbox, null);
            }
            catch (ObjectNotFoundException exception)
            {
                EncryptionConfigurationTable.logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_E4EOrganizationMailboxWebServiceUrlRetrievalFailed, domain, new object[]
                {
                    "ProcessEncryptionConfiguration",
                    EncryptionConfigurationTable.GetLoggedExceptionString(exception)
                });
                return(null);
            }
            Uri backEndWebServicesUrl;

            try
            {
                backEndWebServicesUrl = BackEndLocator.GetBackEndWebServicesUrl(exchangePrincipal.MailboxInfo);
                stopwatch.Stop();
                requestData.WebServiceUrlLookupTime = stopwatch.ElapsedMilliseconds - requestData.OrgMailboxAdUserLookupTime;
            }
            catch (BackEndLocatorException exception2)
            {
                EncryptionConfigurationTable.logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_E4EOrganizationMailboxWebServiceUrlRetrievalFailed, domain, new object[]
                {
                    "ProcessEncryptionConfiguration",
                    EncryptionConfigurationTable.GetLoggedExceptionString(exception2)
                });
                return(null);
            }
            ExchangeService exchangeService = new ExchangeService(4);

            exchangeService.Url = backEndWebServicesUrl;
            exchangeService.PrivilegedUserId            = new PrivilegedUserId(0, 2, orgMailbox.PrimarySmtpAddress.ToString());
            exchangeService.PrivilegedUserId.BudgetType = new PrivilegedUserIdBudgetType?(2);
            RemoteCertificateValidationCallback callback = (object param0, X509Certificate param1, X509Chain param2, SslPolicyErrors param3) => true;

            CertificateValidationManager.RegisterCallback("E4E.EncryptionConfigurationTable", callback);
            exchangeService.HttpHeaders.Add(CertificateValidationManager.ComponentIdHeaderName, "E4E.EncryptionConfigurationTable");
            return(exchangeService);
        }
        public Exception Ping(Uri url)
        {
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            ExTraceGlobals.VerboseTracer.TraceDebug <Uri>((long)this.GetHashCode(), "[ProtocolPingStrategyBase::Ctor]: Testing server with URL {0}.", url);
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);

            httpWebRequest.ServicePoint.ConnectionLimit = HttpProxySettings.ServicePointConnectionLimit.Value;
            httpWebRequest.Method          = "HEAD";
            httpWebRequest.Timeout         = ProtocolPingStrategyBase.DownLevelServerPingTimeout.Value;
            httpWebRequest.PreAuthenticate = true;
            httpWebRequest.UserAgent       = "HttpProxy.ClientAccessServer2010Ping";
            httpWebRequest.KeepAlive       = false;
            if (!HttpProxySettings.UseDefaultWebProxy.Value)
            {
                httpWebRequest.Proxy = NullWebProxy.Instance;
            }
            httpWebRequest.ServerCertificateValidationCallback = ProxyApplication.RemoteCertificateValidationCallback;
            CertificateValidationManager.SetComponentId(httpWebRequest, Constants.CertificateValidationComponentId);
            this.PrepareRequest(httpWebRequest);
            try
            {
                using (httpWebRequest.GetResponse())
                {
                }
            }
            catch (WebException ex)
            {
                ExTraceGlobals.VerboseTracer.TraceWarning <WebException>((long)this.GetHashCode(), "[ProtocolPingStrategyBase::TestServer]: Web exception: {0}.", ex);
                if (!this.IsWebExceptionExpected(ex))
                {
                    return(ex);
                }
            }
            catch (Exception ex2)
            {
                ExTraceGlobals.VerboseTracer.TraceError <Exception>((long)this.GetHashCode(), "[ProtocolPingStrategyBase::TestServer]: General exception {0}.", ex2);
                return(ex2);
            }
            finally
            {
                try
                {
                    httpWebRequest.Abort();
                }
                catch
                {
                }
            }
            return(null);
        }
Exemple #10
0
 protected virtual void FillRequestProperties(HttpWebRequest request)
 {
     request.ContentType     = "text/xml;charset=utf-8";
     request.UserAgent       = this.UserAgent;
     request.PreAuthenticate = true;
     request.CookieContainer = new CookieContainer();
     if (this.IgnoreSslCertError)
     {
         CertificateValidationManager.RegisterCallback(ServiceValidatorBase.ComponentId, new RemoteCertificateValidationCallback(ServiceValidatorBase.TrustAllCertValidationCallback));
         CertificateValidationManager.SetComponentId(request, ServiceValidatorBase.ComponentId);
     }
 }
Exemple #11
0
 private HttpWebRequest ConfigureRequest(HttpWebRequest request)
 {
     request.CookieContainer = this.CookieContainer;
     request.Proxy           = this.Proxy;
     request.Credentials     = this.Credentials;
     request.UserAgent       = this.UserAgent;
     request.Timeout         = this.Timeout;
     if (!string.IsNullOrEmpty(this.componentId))
     {
         CertificateValidationManager.SetComponentId(request, this.componentId);
     }
     return(this.ApplyHeadersToRequest(request));
 }
Exemple #12
0
        // Token: 0x06001261 RID: 4705 RVA: 0x0006FF40 File Offset: 0x0006E140
        internal static HttpWebRequest CreateHttpWebRequestForProxying(OwaContext owaContext, Uri requestUri)
        {
            HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUri);

            httpWebRequest.UnsafeAuthenticatedConnectionSharing = true;
            httpWebRequest.PreAuthenticate   = true;
            httpWebRequest.AllowAutoRedirect = false;
            httpWebRequest.Credentials       = CredentialCache.DefaultNetworkCredentials.GetCredential(requestUri, "Kerberos");
            if (httpWebRequest.Credentials == null)
            {
                throw new OwaInvalidOperationException("Can't get credentials for the proxy request");
            }
            httpWebRequest.AutomaticDecompression = DecompressionMethods.GZip;
            CertificateValidationManager.SetComponentId(httpWebRequest, requestUri.IsLoopback ? "OWA_IgnoreCertErrors" : "OWA");
            GccUtils.CopyClientIPEndpointsForServerToServerProxy(owaContext.HttpContext, httpWebRequest);
            return(httpWebRequest);
        }
        private HttpWebRequest CopyClientRequest(HttpRequest clientrequest, Uri proxyuri)
        {
            string         b = HttpRequestHeader.Authorization.ToString();
            HttpWebRequest httpWebRequest = this.CreateWebRequest(proxyuri);

            httpWebRequest.Method = clientrequest.HttpMethod;
            for (int i = 0; i < clientrequest.Headers.Count; i++)
            {
                string text = clientrequest.Headers.Keys[i];
                if ((!(text == b) || !this.proxyInfo.CanImpersonate) && !WebHeaderCollection.IsRestricted(text))
                {
                    httpWebRequest.Headers[text] = clientrequest.Headers[text];
                }
            }
            CertificateValidationManager.SetComponentId(httpWebRequest, "AirSync");
            foreach (string text2 in this.proxyInfo.AdditionalHeaders.Keys)
            {
                httpWebRequest.Headers[text2] = this.proxyInfo.AdditionalHeaders[text2];
            }
            if (GlobalSettings.IsGCCEnabled)
            {
                if (GlobalSettings.AreGccStoredSecretKeysValid)
                {
                    string text3 = httpWebRequest.Headers["x-gcc-proxyinfo"];
                    if (string.IsNullOrEmpty(text3) || (!string.IsNullOrEmpty(text3) && !ProxyHandler.HasValidAuthString(text3)))
                    {
                        StringBuilder stringBuilder = new StringBuilder(GccUtils.GetAuthStringForThisServer());
                        stringBuilder.Append(", ");
                        stringBuilder.Append(clientrequest.ServerVariables["REMOTE_ADDR"]);
                        stringBuilder.Append(", ");
                        stringBuilder.Append(clientrequest.ServerVariables["LOCAL_ADDR"]);
                        httpWebRequest.Headers["x-gcc-proxyinfo"] = stringBuilder.ToString();
                    }
                }
                else
                {
                    AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_NoGccStoredSecretKey, "NoGccStoredSecretKey", new string[0]);
                    AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, null, "No gcc stored secret key");
                }
            }
            httpWebRequest.Referer     = clientrequest.Url.AbsoluteUri;
            httpWebRequest.ContentType = clientrequest.ContentType;
            httpWebRequest.UserAgent   = clientrequest.UserAgent;
            return(httpWebRequest);
        }
Exemple #14
0
 static AutodiscoverProxy()
 {
     CertificateValidationManager.RegisterCallback("AutodiscoverProxy", delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
     {
         if (!(sender is HttpWebRequest))
         {
             return(false);
         }
         HttpWebRequest httpWebRequest = (HttpWebRequest)sender;
         Common.EventLog.LogEvent(AutodiscoverEventLogConstants.Tuple_ErrProviderRedirectServerCertificate, Common.PeriodicKey, new object[]
         {
             (httpWebRequest.RequestUri != null) ? httpWebRequest.RequestUri.Host : "Unknown Host",
             (certificate == null) ? "No Certificate" : certificate.Subject,
             sslPolicyErrors
         });
         return(SslConfiguration.AllowExternalUntrustedCerts);
     });
 }
Exemple #15
0
 public NonIndexableDiscoveryEwsClient(GroupId groupId, MailboxInfo[] mailboxes, ExTimeZone timeZone, CallerInfo caller)
 {
     Util.ThrowOnNull(groupId, "groupId");
     Util.ThrowOnNull(mailboxes, "mailboxes");
     Util.ThrowOnNull(timeZone, "timeZone");
     Util.ThrowOnNull(caller, "caller");
     this.groupId    = groupId;
     this.mailboxes  = mailboxes;
     this.callerInfo = caller;
     CertificateValidationManager.RegisterCallback(base.GetType().FullName, new RemoteCertificateValidationCallback(CertificateValidation.CertificateErrorHandler));
     this.service     = new ExchangeService(4, NonIndexableDiscoveryEwsClient.GetTimeZoneInfoFromExTimeZone(timeZone));
     this.service.Url = this.groupId.Uri;
     this.service.HttpHeaders[CertificateValidationManager.ComponentIdHeaderName] = base.GetType().FullName;
     if (this.groupId.GroupType != GroupType.CrossPremise)
     {
         this.service.UserAgent = WellKnownUserAgent.GetEwsNegoAuthUserAgent(base.GetType().FullName);
     }
     this.service.ClientRequestId = this.callerInfo.QueryCorrelationId.ToString("N");
     this.Authenticate();
 }
Exemple #16
0
 private static bool TryProxyAutodiscoverRequest(ProxyRequestData proxyRequestData, string redirectServer, out string rawResponse)
 {
     ExTraceGlobals.AuthenticationTracer.TraceDebug <string>(0L, "AutodiscoverProxy::TryProxyAutodiscoverRequest. Entrypoint. redirectServer = {0}.", redirectServer);
     rawResponse = null;
     if (string.IsNullOrEmpty(redirectServer))
     {
         ExTraceGlobals.AuthenticationTracer.TraceError <string>(0L, "AutodiscoverProxy::TryProxyAutodiscoverRequest. This is an invalid server name. redirectServer = {0}.", redirectServer);
         return(false);
     }
     try
     {
         HttpWebRequest httpWebRequest = proxyRequestData.CloneRequest(redirectServer);
         CertificateValidationManager.SetComponentId(httpWebRequest, "AutodiscoverProxy");
         using (WebResponse response = httpWebRequest.GetResponse())
         {
             using (Stream responseStream = response.GetResponseStream())
             {
                 rawResponse = AutodiscoverProxy.GetResponse(responseStream);
                 if (rawResponse == null)
                 {
                     ExTraceGlobals.AuthenticationTracer.TraceError <string>(0L, "AutodiscoverProxy::TryProxyAutodiscoverRequest. received wrong number of user response. rawResponse = {0}.", rawResponse);
                     return(false);
                 }
                 ExTraceGlobals.AuthenticationTracer.TraceDebug <string, string>(0L, "AutodiscoverProxy::TryProxyAutodiscoverRequest. Received response for user. redirectServer = {0}, rawResponse = {1}.", redirectServer, rawResponse);
             }
         }
     }
     catch (LocalizedException arg)
     {
         ExTraceGlobals.AuthenticationTracer.TraceError <LocalizedException>(0L, "AutodiscoverProxy::TryProxyAutodiscoverRequest caught with a LocalizedException. LocalizedException = {0}.", arg);
         return(false);
     }
     catch (WebException arg2)
     {
         ExTraceGlobals.AuthenticationTracer.TraceError <WebException>(0L, "AutodiscoverProxy::TryProxyAutodiscoverRequest caught with a WebException. WebException = {0}.", arg2);
         return(false);
     }
     return(true);
 }
            protected override WebRequest GetWebRequest(Uri uri)
            {
                WebRequest webRequest = base.GetWebRequest(uri);

                if (webRequest is HttpWebRequest)
                {
                    HttpWebRequest request = webRequest as HttpWebRequest;
                    if (this.trustSslCert)
                    {
                        CertificateValidationManager.SetComponentId(request, "Microsoft.Exchange.Data.Directory.SystemConfiguration.AuthMetadataClient.NoSsl");
                    }
                    else
                    {
                        CertificateValidationManager.SetComponentId(request, "Microsoft.Exchange.Data.Directory.SystemConfiguration.AuthMetadataClient");
                    }
                }
                if (this.Timeout != 0)
                {
                    webRequest.Timeout = this.Timeout;
                }
                return(webRequest);
            }
Exemple #18
0
        public DiscoveryEwsClient(GroupId groupId, MailboxInfo[] mailboxes, SearchCriteria searchCriteria, PagingInfo pagingInfo, CallerInfo caller)
        {
            this.groupId        = groupId;
            this.mailboxes      = mailboxes;
            this.searchCriteria = searchCriteria;
            this.pagingInfo     = pagingInfo;
            this.callerInfo     = caller;
            CertificateValidationManager.RegisterCallback(base.GetType().FullName, new RemoteCertificateValidationCallback(CertificateValidation.CertificateErrorHandler));
            this.service     = new ExchangeService(4, DiscoveryEwsClient.GetTimeZoneInfoFromExTimeZone(this.pagingInfo.TimeZone));
            this.service.Url = this.groupId.Uri;
            this.service.HttpHeaders[CertificateValidationManager.ComponentIdHeaderName] = base.GetType().FullName;
            string text = string.Format("{0}&FOUT=true", caller.UserAgent);

            if (this.groupId.GroupType != GroupType.CrossPremise)
            {
                this.service.UserAgent = WellKnownUserAgent.GetEwsNegoAuthUserAgent(string.Format("{0}-{1}", DiscoveryEwsClient.CrossServerUserAgent, text));
            }
            else
            {
                this.service.UserAgent = text;
            }
            this.service.ClientRequestId = this.callerInfo.QueryCorrelationId.ToString("N");
            this.Authenticate();
        }
 static CommandInvocation()
 {
     CertificateValidationManager.RegisterCallback("CommandInvcocation", new RemoteCertificateValidationCallback(CommandInvocation.CertificateNoValidationCallback));
 }
        protected override IAsyncResult BeginInvoke()
        {
            this.timer = Stopwatch.StartNew();
            string xmlBody = this.GetXmlBody();

            byte[] bytes = Encoding.UTF8.GetBytes(xmlBody);
            WindowsImpersonationContext windowsImpersonationContext = null;
            Exception ex = null;

            try
            {
                this.request             = (HttpWebRequest)WebRequest.Create(this.targetUri);
                this.request.Method      = "POST";
                this.request.ContentType = "text/xml";
                this.request.Headers.Add("X-AnchorMailbox", this.emailAddress.Address);
                if (this.credentialsForDiscovery == null)
                {
                    if (Testability.WebServiceCredentials == null)
                    {
                        windowsImpersonationContext = NetworkServiceImpersonator.Impersonate();
                        this.impersonating          = true;
                    }
                    this.credentialsForDiscovery = CredentialCache.DefaultCredentials;
                    this.request.Credentials     = this.credentialsForDiscovery;
                }
                else
                {
                    CredentialCache credentialCache = new CredentialCache();
                    credentialCache.Add(this.targetUri, "Basic", (NetworkCredential)this.credentialsForDiscovery);
                    this.request.Credentials     = credentialCache;
                    this.request.PreAuthenticate = true;
                }
                this.request.Timeout           = (int)this.timeout.TotalMilliseconds;
                this.request.UserAgent         = this.GetUserAgent();
                this.request.AllowAutoRedirect = false;
                this.request.ContentLength     = (long)bytes.Length;
                if (this.bypassProxy)
                {
                    this.request.Proxy = new WebProxy();
                }
                CertificateValidationManager.SetComponentId(this.request, Globals.CertificateValidationComponentId);
                using (Stream requestStream = this.request.GetRequestStream())
                {
                    requestStream.Write(bytes, 0, bytes.Length);
                }
                AutoDiscoverRequest.AutoDiscoverTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Sending request to AutoDiscover service, xml body: {1}", TraceContext.Get(), xmlBody);
                if (base.Aborted)
                {
                    this.request.Abort();
                }
                return(this.request.BeginGetResponse(new AsyncCallback(base.Complete), null));
            }
            catch (ProtocolViolationException ex2)
            {
                ex = ex2;
            }
            catch (SecurityException ex3)
            {
                ex = ex3;
            }
            catch (ArgumentException ex4)
            {
                ex = ex4;
            }
            catch (InvalidOperationException ex5)
            {
                ex = ex5;
            }
            catch (NotSupportedException ex6)
            {
                ex = ex6;
            }
            catch (XmlException ex7)
            {
                ex = ex7;
            }
            catch (XPathException ex8)
            {
                ex = ex8;
            }
            catch
            {
                throw;
            }
            finally
            {
                if (windowsImpersonationContext != null)
                {
                    windowsImpersonationContext.Dispose();
                    this.impersonating = false;
                }
            }
            if (ex != null)
            {
                this.HandleException(ex);
            }
            return(null);
        }
Exemple #21
0
 static RemoteNotificationRequester()
 {
     CertificateValidationManager.RegisterCallback("RemoteNotification", new RemoteCertificateValidationCallback(RemoteNotificationRequester.SslCertificateValidationCallback));
 }
Exemple #22
0
 // Token: 0x060011E4 RID: 4580 RVA: 0x0006C1A8 File Offset: 0x0006A3A8
 public static void Initialize()
 {
     CertificateValidationManager.RegisterCallback("OWA", new RemoteCertificateValidationCallback(ProxyEventHandler.SslCertificateValidationCallback));
     CertificateValidationManager.RegisterCallback("OWA_IgnoreCertErrors", new RemoteCertificateValidationCallback(ProxyEventHandler.SslCertificateIgnoreCallback));
     ServicePointManager.DefaultConnectionLimit = Globals.ServicePointConnectionLimit;
 }
 // Token: 0x06001A9F RID: 6815 RVA: 0x00063D84 File Offset: 0x00061F84
 static GetPersonaPhoto()
 {
     CertificateValidationManager.RegisterCallback("GetPersonaPhoto", new RemoteCertificateValidationCallback(CommonCertificateValidationCallbacks.InternalServerToServer));
 }
 static AuthMetadataClient()
 {
     CertificateValidationManager.RegisterCallback("Microsoft.Exchange.Data.Directory.SystemConfiguration.AuthMetadataClient.NoSsl", new RemoteCertificateValidationCallback(AuthMetadataClient.ServerCertificateValidatorIgnoreSslErrors));
     CertificateValidationManager.RegisterCallback("Microsoft.Exchange.Data.Directory.SystemConfiguration.AuthMetadataClient", new RemoteCertificateValidationCallback(AuthMetadataClient.ServerCertificateValidator));
 }
 static GlobalSettings()
 {
     CertificateValidationManager.RegisterCallback("AirSync", new RemoteCertificateValidationCallback(ProxyHandler.SslCertificateValidationCallback));
 }