Unable to add Basic Authentication to your Sitecore Site? Check for WebMatrix!

Unable to add Basic Authentication to your Sitecore Site? Check for WebMatrix!

I recently ran into an issue where I was unable to add basic authentication to a Sitecore site – and the fix for it turned out to have nothing to do with Sitecore at all.

Adding basic authentication through IIS is easy (usually) – disable anonymous authentication and enable/configure basic authentication. But no matter what I tried, I could not get IIS to perform the basic authentication for me. Even when disabling all authentication methods, the site would still be served ok.

As it turns out, the project that was deployed had the WebMatrix DLLs included. And the pure existence of these DLLs would trip up IIS authentication! There’s a stack overflow article here that also describes the problem.

The Sitecore instance in question does not use WebMatrix, so I could safely removing the following NuGet packages from the solution:

  • Microsoft.AspNet.WebHelpers
  • Microsoft.AspNet.WebPages.WebData
  • Microsoft.AspNet.WebPages.Data

And then delete these DLLs from all target instances:

  • Microsoft.Web.Helpers.dll
  • WebMatrix.WebData.dll
  • WebMatrix.Data.dll

And boom – authentication through IIS started to work as expected.

Leave a Reply

Your email address will not be published. Required fields are marked *