Right before christmas I got a “The XSLT stylesheet could not be loaded” error message from the EasySearch FacetCollection control on a customers test server. This confused me quite a lot as the FacetCollection control had worked without problems a couple of days earlier.
The first thing that came to mind when seeing this error message was access rights. Maybe the file permissions had been changed after the last deploy to the server? I checked this, and the file permissions were fine. So I checked the MIME types for .xsl and .xslt, but they were also correct. I suddenly realized that I was able to access the XSLT stylesheets by their url’s on the server, which meant that there had to be an access issue somewhere.
Unfortunately, I couldn’t find it. And to make matters worse, I couldn’t find the piece of code that returned the error message. So I ended up sending an email to NetworkedPlanet support. After asking me to check my file permissions (duh…), they found the issue.
The site was using Basic authentication! We had changed from Windows to Basic authentication a couple of days earlier, but apparently this line in the AbstractXmlControl.cs returns a HTTP 401 – Unauthorized exception if the site uses Basic authentication:
ret.Load(targetUri.ToString(), null, resolver);
Luckily, the site is supposed to use Windows authenication, so we simply switched back.
If you need to use Basic authentication, you can solve this issue by adding the XSLT stylesheet in the code behind:
FlatListFacet.XslStylesheet = File.ReadAllText(pathToXslt);
I’d like to thank the NetworkedPlanet support team for great service and resonse time!