Wednesday, April 24, 2024

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error



Turns out the fix was to simply enable SSL in F4 properties windows and default website start url to SSL url



Monday, March 11, 2024

Visual Studio ( or VS Code) strip all attributes from html tags

 This is a very simple shortcut, find and replace using following regex

Find - <(table|tr|td|p|div|span)[\S\s]*?\n?>

Replace - <$1>

Wednesday, February 23, 2022

SharePoint provider hosted app certificate trust issues

 It is important to configure certificates correctly for a provider hosted app in SharePoint website since the authentication requires communication between Azure AD, SharePoint, and our app, which is hosted on a different IIS server.

I have added this method to TokenHelper class and call it in CSOM webpart methods to trust certificates

public class TokenHelper

    {

            #region public methods

 

            /// <summary>

            /// Configures .Net to trust all certificates when making network calls.  This is used so that calls

            /// to an https SharePoint server without a valid certificate are not rejected.  This should only be used during

            /// testing, and should never be used in a production app.

            /// </summary>

            public static void TrustAllCertificates()

            {

                //Trust all certificates

                System.Net.ServicePointManager.ServerCertificateValidationCallback =

                    ((sender, certificate, chain, sslPolicyErrors) => true);

            }

}

Also there are some articles which describe certificates trust configuration on a sharepoint farm

https://docs.microsoft.com/en-us/sharepoint/troubleshoot/sharing-and-permissions/ssl-certificate-authentication

https://docs.microsoft.com/en-us/sharepoint/administration/exchange-trust-certificates-between-farms

https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/create-high-trust-sharepoint-add-ins


SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...