[Update 2014-02-18]: I spoke too soon, after some further testing, it turned out it wasn’t the CU that ended up resolving the problem (although it may still be a contributor…I’ll need to find another environment to do some testing).  I also found some features that weren’t activated/deactivated the same between the environments.  After setting all the features the same and being on the same patch level, this issue still exists.  Still trying to find the root cause and the differences between the environment.  If anyone has any ideas feel free make suggestions in the comments below and I’ll give it a try! 🙂

[Original Post 2014-02-17]: I was working on a custom master page for the my site host in SharePoint 2013 over the last few days and ran into an issue where whenever I had the custom master page applied I was getting a 401 Unauthorized error in certain situations (you can see a screen shot of it below).

NewImage

Other times, I wouldn’t get the error.  I finally traced it down the minimal download strategy feature (MDS) in SharePoint 2013.  If either a) this feature was disabled; or b) I went directly to the asps page (i.e. http://mysite/default.aspx instead of http://mysite/_layouts/15/start.aspx#/default.aspx – this is the form of URL you’ll get with the minimal download strategy.).

Fortunately, I was able to find several blog articles about it:

  1. http://www.wictorwilen.se/sharepoint-2013—introduction-to-the-minimal-download-strategy-mds
  2. http://www.sharepointfront.com/unautorized-401-sharepoint-2013-with-a-custom-master-page/
  3. http://chuvash.eu/2013/06/26/make-javascript-code-work-with-minimal-download-strategy-part-2/

Unfortunately, I couldn’t get any of these to work in the environment I was working in.  All I was doing was placing a SharePoint:ScriptLink in my Master Page,  the rest of the MasterPage was copied directly from mysite15.master.  So, what could this one line of code be doing causing a 401 error.  Unfortunetly, I don’t really know anything other than, it’s a bug in one (or more) particular builds of SharePoint 2013.

Because, my next step was try a different environment and low and behold it worked.  From there it didn’t take long, I found the environment that didn’t work was running the SharePoint 2013, March 2013 Public Update (PU) and the environment that did work was running the SharePoint 2013, December 2013 Cumulative Update (CU).  After updating the March 2013 PU to the December 2013 CU, everything started working.  I don’t know which CU (April, June, August, October or December) actually has the fix in it…if I have time to go find it, that will be an update to this post.  Or, if anyone knows which CU fixed this issue, feel free to leave it in the comments.