Quantcast
Channel: Forum Microsoft Identity Manager
Viewing all articles
Browse latest Browse all 4767

"The request failed. The underlying connection was closed: Could not establish trust relationship for the SSL\/TLS secure channel."

$
0
0

Hello,

Can someone please tell me the solution for this issue. I am trying to connect to my exchange server and its throwing this error. I have also imported the certificate and placed in root folder. But still find the same error. Going craxy from 3 days plz someone help me.Here is my code:

  public string CheckAvailability(string value)
        {
            try
            {
                //ServicePointManager.ServerCertificateValidationCallback = CertificateValidationCallBack;

                //Connecting to EWS by using the EWS Managed API 2.0
                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);

                // Connect by using the default credentials of the authenticated user.
                //service.UseDefaultCredentials = true;

                // Connect by using the credentials of user
                service.Credentials = new NetworkCredential("UID", "PWD", "Domain");

                service.TraceEnabled = true;
                service.TraceFlags = TraceFlags.All;   

                // Use Autodiscover to set the URL endpoint.You should either set the URL explicitly or call AutodiscoverUrl, but you should not do both.
                service.Url = new Uri("https://ad-lab/ews/Services.asmx");
             

                //EmailMessage msg = new EmailMessage(service);
                //msg.ToRecipients.Add(new EmailAddress("xyz@domain.com "));
                //msg.Subject = "Test email";
                //msg.Body = new MessageBody(BodyType.HTML, "<p>Hello Email!</p>");
                //msg.Send();
                GetUserFreeBusy(service);
                return "Hello " + value;

            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            finally { }
        }

Thanks,

Sravani


Viewing all articles
Browse latest Browse all 4767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>