locked
https connection RRS feed

  • Question

  •  

    Hello. I need to connect to host using https. At first it is necessary to accept a certificate... Here is the first question... Is there any way to recieve certificate directly from host (on example like you do in Opera) and not to save it locally. I didn't solve this problem and I deicided to keep certificate locally and to use it in every connection. After certificate acception I need to login using current windows session login info (NTLM). Here is my code:

    -------------------------------------------------

    WebRequest request = WebRequest.Create( uri );

    request.ConnectionGroupName = WindowsIdentity.GetCurrent().Name;

    request.Credentials = CredentialCache.DefaultCredentials;

    (request as HttpWebRequest).ClientCertificates.Add(X509Certificate.CreateFromCertFile("certificate.cer"));

    WebResponse res = request.GetResponse();

    ----------------------------------------------------------

    I have a "The remote server returned an error: (401) Unauthorized." exception in last code instruction ... What am I doing wrong ?

    Thanks for help

    Tuesday, February 27, 2007 10:16 AM