hesam jahangiri

hesam jahangiri

  • NA
  • 8
  • 6.5k

convert to vb.net

Jan 4 2013 1:25 PM
hi
i have a problem and i cant convert to vb.net

------------------------------------------------------------------------
  public class PermissiveCertificatePolicy
    {
        private PermissiveCertificatePolicy()
        {
        }
        private readonly string subjectName;
        private static PermissiveCertificatePolicy currentPolicy;
        PermissiveCertificatePolicy(string subjectName)
        {
            this.subjectName = subjectName;
            ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback(RemoteCertValidate);
        }

        public static void Enact(string subjectName)
        {
            currentPolicy = new PermissiveCertificatePolicy(subjectName);
        }

        bool RemoteCertValidate(object sender, X509Certificate cert, X509Chain chain, System.Net.Security.SslPolicyErrors error)
        {
            if (subjectName == "*")
            {
                return true;
            }
            else if (cert.Subject == subjectName)
            {
                return true;
            }
            else return false;
        }
    }

Answers (1)