• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Net.ServicePoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Net.ServicePoint的典型用法代码示例。如果您正苦于以下问题:C# ServicePoint类的具体用法?C# ServicePoint怎么用?C# ServicePoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ServicePoint类属于System.Net命名空间,在下文中一共展示了ServicePoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: WebConnectionGroup

		public WebConnectionGroup (ServicePoint sPoint, string name)
		{
			this.sPoint = sPoint;
			this.name = name;
			connections = new ArrayList (1);
			queue = new Queue ();
		}
开发者ID:GirlD,项目名称:mono,代码行数:7,代码来源:WebConnectionGroup.cs


示例2: Invoke

        internal bool Invoke(string hostName,
                             ServicePoint servicePoint,
                             X509Certificate certificate,
                             WebRequest request,
                             X509Chain chain,
                             SslPolicyErrors sslPolicyErrors)
        {
            PolicyWrapper policyWrapper = new PolicyWrapper(m_CertificatePolicy,
                                                            servicePoint,
                                                            (WebRequest) request);

            if (m_Context == null)
            {
                return policyWrapper.CheckErrors(hostName,
                                                 certificate,
                                                 chain,
                                                 sslPolicyErrors);
            }
            else
            {
                ExecutionContext execContext = m_Context.CreateCopy();
                CallbackContext callbackContext = new CallbackContext(policyWrapper,
                                                                      hostName,
                                                                      certificate,
                                                                      chain,
                                                                      sslPolicyErrors);
                ExecutionContext.Run(execContext, Callback, callbackContext);
                return callbackContext.result;
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:30,代码来源:ServicePointManager.cs


示例3: CheckValidationResult

 public bool CheckValidationResult(ServicePoint sPoint,
     System.Security.Cryptography.X509Certificates.X509Certificate cert,
     WebRequest wRequest, int certProb)
 {
     // Always accept
     return true;
 }
开发者ID:RavenB,项目名称:gridsearch,代码行数:7,代码来源:Login.cs


示例4: CheckValidationResult

      // ICertificatePolicy
      public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest request, int problem) {
         if (problem == 0) {
            // Check whether we have accumulated any problems so far:
            ArrayList problemArray = (ArrayList) request2problems_[request];
            if (problemArray == null) {
               // No problems so far
               return true;
            }

            string problemList = "";
            foreach (uint problemCode in problemArray) {
               string problemText = (string) problem2text_[problemCode];
               if (problemText == null) {
                  problemText = "Unknown problem";
               }
               problemList += "* " + problemText + "\n\n";
            }

            request2problems_.Remove(request);
            System.Console.WriteLine("There were one or more problems with the server certificate:\n\n" + problemList);
            return true;


         } else {
            // Stash the problem in the problem array:
            ArrayList problemArray = (ArrayList) request2problems_[request];
            if (problemArray == null) {
               problemArray = new ArrayList();
               request2problems_[request] = problemArray;
            }
            problemArray.Add((uint) problem);
            return true;
         }
      }   
开发者ID:Nikolay-Krasan,项目名称:DegreeWork,代码行数:35,代码来源:CertPolicy.cs


示例5: TlsStream

        //
        // This version of an Ssl Stream is for internal HttpWebrequest use.
        // This Ssl client owns the underlined socket
        // The TlsStream will own secured read/write and disposal of the passed "networkStream" stream.
        //
        public TlsStream(string destinationHost, NetworkStream networkStream, X509CertificateCollection clientCertificates, ServicePoint servicePoint, object initiatingRequest, ExecutionContext executionContext)
               :base(networkStream, true) {

        // WebRequest manages the execution context manually so we have to ensure we get one for SSL client certificate demand
        _ExecutionContext = executionContext;
        if (_ExecutionContext == null)
        {
            _ExecutionContext = ExecutionContext.Capture();
        }

        // 


         GlobalLog.Enter("TlsStream::TlsStream", "host="+destinationHost+", #certs="+((clientCertificates == null) ? "none" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));
         if (Logging.On) Logging.PrintInfo(Logging.Web, this, ".ctor", "host="+destinationHost+", #certs="+((clientCertificates == null) ? "null" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));

         m_ExceptionStatus = WebExceptionStatus.SecureChannelFailure;
         m_Worker = new SslState(networkStream, initiatingRequest is HttpWebRequest, SettingsSectionInternal.Section.EncryptionPolicy);

         m_DestinationHost = destinationHost;
         m_ClientCertificates = clientCertificates;

         RemoteCertValidationCallback certValidationCallback = servicePoint.SetupHandshakeDoneProcedure(this, initiatingRequest);
         m_Worker.SetCertValidationDelegate(certValidationCallback);

         // The Handshake is NOT done at this point
         GlobalLog.Leave("TlsStream::TlsStream (Handshake is not done)");
        }
开发者ID:REALTOBIZ,项目名称:mono,代码行数:33,代码来源:_TLSstream.cs


示例6: CheckValidationResult

        public bool CheckValidationResult(ServicePoint sp, 
						   X509Certificate certificate,
						   WebRequest request,
						   int error)
        {
            return true;
        }
开发者ID:Dynalon,项目名称:tomboy-library,代码行数:7,代码来源:OAuthTests.cs


示例7: CheckValidationResult

 public bool CheckValidationResult(ServicePoint sp,
     X509Certificate cert,
     WebRequest req,
     int problem)
 {
     return true;
 }
开发者ID:Nikolay-Krasan,项目名称:DegreeWork,代码行数:7,代码来源:TrustAllCertificatePolicy.cs


示例8: CheckValidationResult

 public bool CheckValidationResult(ServicePoint sp, 
     System.Security.Cryptography.X509Certificates.X509Certificate crt,
     WebRequest req, 
     int problem)
 {
     return true;
 }
开发者ID:josecomboni,项目名称:csharp_binding_v1,代码行数:7,代码来源:TrustAllCertificatesPolicy.cs


示例9: CheckValidationResult

        public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest request, int problem)
        {
            if (problem == -2146762487 || problem == 0 || problem == -2146762481)
                return true;

            return false;
        }
开发者ID:menasbeshay,项目名称:ivalley-svn,代码行数:7,代码来源:trustallcer.cs


示例10: BeginGetConnection

 internal IAsyncResult BeginGetConnection(ServicePoint servicePoint, ContextAwareResult outerResult, AsyncCallback callback, object state)
 {
     IAsyncResult result = null;
     try
     {
         this.UpdateServicePoint(servicePoint);
         this.connection = new SmtpConnection(this, this.client, this.credentials, this.authenticationModules);
         this.connection.Timeout = this.timeout;
         if (Logging.On)
         {
             Logging.Associate(Logging.Web, this, this.connection);
         }
         if (this.EnableSsl)
         {
             this.connection.EnableSsl = true;
             this.connection.ClientCertificates = this.ClientCertificates;
         }
         result = this.connection.BeginGetConnection(servicePoint, outerResult, callback, state);
     }
     catch (Exception exception)
     {
         throw new SmtpException(SR.GetString("MailHostNotFound"), exception);
     }
     return result;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:SmtpTransport.cs


示例11: CheckValidationResult

 public bool CheckValidationResult(ServicePoint srvPoint,
     X509Certificate certificate, WebRequest request,
     int certificateProblem)
 {
     //Return True to force the certificate to be accepted.
     return true;
 }
开发者ID:innoist,项目名称:GF-FRS,代码行数:7,代码来源:MyPolicy.cs


示例12: CheckValidationResult

            public bool CheckValidationResult(ServicePoint sp, X509Certificate cert,
            WebRequest request, int problem)
            {
                var validationResult = true;
                                
                if (IssuerName != "[email protected]==")
                    if (!cert.Issuer.ToUpper().Contains(IssuerName.ToUpper().Trim())) return false;

                var chain = new X509Chain();


                chain.Build(new X509Certificate2(cert));

                foreach (X509ChainElement e in chain.ChainElements)
                {
                    foreach (X509ChainStatus s in e.ChainElementStatus)
                    {
                        if (((X509ChainStatusFlags.Revoked | X509ChainStatusFlags.NotTimeValid
                            | X509ChainStatusFlags.NotSignatureValid | X509ChainStatusFlags.InvalidExtension
                            | X509ChainStatusFlags.NotValidForUsage | X509ChainStatusFlags.Cyclic) & s.Status) == s.Status)
                        {
                            validationResult = false;
                        }
                    }
                }

                return validationResult;
            }
开发者ID:sreenandini,项目名称:test_buildscripts,代码行数:28,代码来源:Certificate.cs


示例13: WebConnectionGroup

		public WebConnectionGroup (ServicePoint sPoint, string name)
		{
			this.sPoint = sPoint;
			this.name = name;
			connections = new LinkedList<ConnectionState> ();
			queue = new Queue ();
		}
开发者ID:nlhepler,项目名称:mono,代码行数:7,代码来源:WebConnectionGroup.cs


示例14: CheckValidationResult

 public bool CheckValidationResult(
     ServicePoint srvPoint,
     X509Certificate certificate,
     WebRequest request,
     int certificateProblem)
 {
     return true;
 }
开发者ID:ejarlewski,项目名称:reyna.net,代码行数:8,代码来源:AcceptAllCertificatePolicy.cs


示例15: CheckValidationResult

        public bool CheckValidationResult(ServicePoint service_point,
		                                   X509Certificate certificate,
		                                   WebRequest request,
						   int problem)
        {
            Log.Warning ("Blindly trusting " + request.RequestUri);
            return true;
        }
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:8,代码来源:BlindTrustCertificatePolicy.cs


示例16: ConnectionGroup

 //
 // Constructors
 //
 internal ConnectionGroup(ServicePoint servicePoint, string connName) {
     m_ServicePoint      = servicePoint;
     m_ConnectionLimit   = servicePoint.ConnectionLimit;
     m_ConnectionList    = new ArrayList(DefaultConnectionListSize); //it may grow beyond
     m_Name              = MakeQueryStr(connName);
     m_AbortDelegate     = new HttpAbortDelegate(Abort);
     GlobalLog.Print("ConnectionGroup::.ctor m_ConnectionLimit:" + m_ConnectionLimit.ToString());
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:11,代码来源:_connectiongroup.cs


示例17: BindIPEndPointCallback

 /// <summary>
 /// Used internally as callback delegate for the <see cref="ServicePoint.BindIPEndPointDelegate"/> property
 /// in <see cref="HttpWebRequest.ServicePoint"/>.
 /// </summary>
 /// <param name="servicePoint">The service point which is currently being bound.</param>
 /// <param name="remoteEndPoint">The desired remote endoint to reach.</param>
 /// <param name="preferredLocalIpAddress">Address which specifies the preferred local endpoint. This address is not part of the delegate
 /// signature and must be provided from outside.</param>
 /// <param name="retryCount">The number of times this delegate was called for a specified connection.</param>
 /// <returns>The local IPEndPoint to which the ServicePoint should bind.</returns>
 public static IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint,
     IPAddress preferredLocalIpAddress, int retryCount)
 {
   if (retryCount > 0)
     return null;
   IPEndPoint ipe = new IPEndPoint(preferredLocalIpAddress, 0);
   return ipe;
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:18,代码来源:NetworkUtils.cs


示例18: CheckValidationResult

 // Default policy for certificate validation.
 // public static bool DefaultValidate = false;
 public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest request, int problem)
 {
     //bool ValidationResult = false;
        //Console.WriteLine("Certificate Problem with accessing " + request.RequestUri);
        //Console.Write("Problem code 0x{0:X8},", (int)problem);
        //Console.WriteLine(GetProblemMessage((CertificateProblem)problem));
        //ValidationResult = DefaultValidate;
        return true;
 }
开发者ID:weavver,项目名称:net,代码行数:11,代码来源:FormUploadCertPolicy.cs


示例19: CheckValidationResult

        public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem)
        {
            // Don't care about any certificate issues, always accept.
            // More information can be found on:
            //    - http://www.mono-project.com/UsingTrustedRootsRespectfully
            //    - http://www.mono-project.com/FAQ:_Security

            return true;
        }
开发者ID:jnsn,项目名称:Gowk,代码行数:9,代码来源:CertificateValidation.cs


示例20: CheckValidationResult

		/// <summary>
		/// Simulates a certificate verification.
		/// </summary>
		/// <param name="sp">The associated ServicePoint.</param>
		/// <param name="cert">The certificate to examine.</param>
		/// <param name="req">The WebRequest to use.</param>
		/// <param name="problem">I have no idea.</param>
		/// <returns>Always returns true.</returns>
		public bool CheckValidationResult(ServicePoint sp, System.Security.Cryptography.X509Certificates.X509Certificate cert, WebRequest req, int problem) {
			try {
				Debug.WriteLine("ICertificatePolicy: Address: " + sp.Address);
				Debug.WriteLine("ICertificatePolicy: ProtocolVersion: " + sp.ProtocolVersion);
				Debug.WriteLine("ICertificatePolicy: Expect100Continue: " + sp.Expect100Continue);
			} catch(Exception ex) {
				Debug.WriteLine("ICertificatePolicy: Exception: " + ex.Message);
			}
			return true;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:18,代码来源:GmailCertificatePolicy.cs



注:本文中的System.Net.ServicePoint类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Net.SocketAddress类代码示例发布时间:2022-05-26
下一篇:
C# Net.SafeDeleteContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap