Example #1
0
        public static SEClient GetConnection()
        {
            SEClient seClient = new SEClient {
                Url = URL
            };

            seClient.SetAuthentication(Username, Password);

            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

            return(seClient);
        }
Example #2
0
            public static SEClient GetConnection()
            {
                string URL      = "";
                string Username = "";
                string Password = "";

                XDocument doc   = XDocument.Load((CaminhoDadosXML(caminho) + @"System.net.b.xml"));
                var       prods = from p in doc.Descendants("B_dado")
                                  select new
                {
                    url      = p.Element("url").Value,
                    Username = p.Element("Username").Value,
                    Password = p.Element("Password").Value,
                };

                foreach (var p in prods)
                {
                    URL      = p.url;
                    Username = p.Username;
                    Password = p.Password;
                }

                #region autentication

                string DcryptLogin = Username;
                Username = DecryptLogin(DcryptLogin);

                string DcryptPassword = Password;
                Password = DecryptLogin(DcryptPassword);

                #endregion


                SEClient seClient = new SEClient {
                    Url = URL
                };
                seClient.SetAuthentication(Username, Password);

                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
                ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

                return(seClient);
            }