I have been doing some test migrating .NET Framework 4.6.2 apps to .NET Core 2. I noticed that this particular app, a monitoring http is not working fine with Net Core 2. Can you please help me to verify what is happening?
static void Main(string[] args)
{
try
{
HttpWebRequest myhttpWebReqest = (HttpWebRequest)WebRequest.Create("https://www.google.com.mx/");
System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
timer.Start();
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myhttpWebReqest.GetResponse();
timer.Stop();
TimeSpan timeSpan = timer.Elapsed;
Console.WriteLine(timeSpan.ToString());
Console.WriteLine();
Console.WriteLine(myHttpWebResponse.StatusCode);
Console.WriteLine((int)myHttpWebResponse.StatusCode);
Console.WriteLine();
Console.WriteLine(myhttpWebReqest.ServicePoint.Certificate.GetEffectiveDateString());
Console.WriteLine();
Console.WriteLine(myhttpWebReqest.ServicePoint.Certificate.GetExpirationDateString());
Console.WriteLine();
Console.WriteLine(myhttpWebReqest.ServicePoint.Certificate.Issuer);
Console.WriteLine();
Console.WriteLine(myhttpWebReqest.ServicePoint.Certificate.Subject);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
if(ex.InnerException !=null)
{
Console.WriteLine(ex.InnerException);
}
}
Console.ReadLine();
}
}
in the .NET Framework 4.6.2 i see the certificate data, in the .NET Core 2 i see myhttpWebReqest.ServicePoint.Certificate null ... do you know why?