Last week, we delivered a federated development workshop with Visual Studio 2015 and Active Directory. During the workshop exercises, we found that the self-signed certificate will make the Visual Studio project. One of our researcher, Sonny shows us the solution below.
Problem
You create a web application that use federated identity such as Active directory. However, during the development we faced an error because it used self-signed certification.
Cause
It might be because the compatibility issues on Visual Studio and Self-Signed Certification
Solution
Add this codes on Global.asax.cs (
Source)
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
for 4.5 and C#5 -
type="Microsoft.CSharp.CSharpCodeProvider...
for 4.6 and C#6 -
type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"