本文整理汇总了C#中System.Net.ServicePoint类的典型用法代码示例。如果您正苦于以下问题:C# ServicePoint类的具体用法?C# ServicePoint怎么用?C# ServicePoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServicePoint类属于System.Net命名空间,在下文中一共展示了ServicePoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WebConnectionGroup
public WebConnectionGroup (ServicePoint sPoint, string name)
{
this.sPoint = sPoint;
this.name = name;
connections = new ArrayList (1);
queue = new Queue ();
}
示例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;
}
}
示例3: CheckValidationResult
public bool CheckValidationResult(ServicePoint sPoint,
System.Security.Cryptography.X509Certificates.X509Certificate cert,
WebRequest wRequest, int certProb)
{
// Always accept
return true;
}
示例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;
}
}
示例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)");
}
示例6: CheckValidationResult
public bool CheckValidationResult(ServicePoint sp,
X509Certificate certificate,
WebRequest request,
int error)
{
return true;
}
示例7: CheckValidationResult
public bool CheckValidationResult(ServicePoint sp,
X509Certificate cert,
WebRequest req,
int problem)
{
return true;
}
示例8: CheckValidationResult
public bool CheckValidationResult(ServicePoint sp,
System.Security.Cryptography.X509Certificates.X509Certificate crt,
WebRequest req,
int problem)
{
return true;
}
示例9: CheckValidationResult
public bool CheckValidationResult(ServicePoint sp, X509Certificate cert, WebRequest request, int problem)
{
if (problem == -2146762487 || problem == 0 || problem == -2146762481)
return true;
return false;
}
示例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;
}
示例11: CheckValidationResult
public bool CheckValidationResult(ServicePoint srvPoint,
X509Certificate certificate, WebRequest request,
int certificateProblem)
{
//Return True to force the certificate to be accepted.
return true;
}
示例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;
}
示例13: WebConnectionGroup
public WebConnectionGroup (ServicePoint sPoint, string name)
{
this.sPoint = sPoint;
this.name = name;
connections = new LinkedList<ConnectionState> ();
queue = new Queue ();
}
示例14: CheckValidationResult
public bool CheckValidationResult(
ServicePoint srvPoint,
X509Certificate certificate,
WebRequest request,
int certificateProblem)
{
return true;
}
示例15: CheckValidationResult
public bool CheckValidationResult(ServicePoint service_point,
X509Certificate certificate,
WebRequest request,
int problem)
{
Log.Warning ("Blindly trusting " + request.RequestUri);
return true;
}