Monday

System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

[Web Service in .net , webservice security]
when call webservice with bad certificate (VB.NET)

1.Add imports
Imports System.Net.Security
Imports System.Security.Cryptography.X509Certificates

2.before calling webservice:
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf customXertificateValidation)

3.Custom certificate runner:
Private Shared Function customXertificateValidation(ByVal sender As Object, ByVal cert As X509Certificate, ByVal chain As X509Chain, ByVal Errora As SslPolicyErrors) As Boolean
Return True
End Function


more...

1 comment:

admin said...

for different version of .net different code required here is link on msdn
http://msdn.microsoft.com/en-us/library/bb738067.aspx

test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...