{"id":1983,"date":"2010-06-25T11:29:06","date_gmt":"2010-06-25T10:29:06","guid":{"rendered":"https:\/\/yvespeneveyre8e29bf869d.wordpress.com\/2010\/06\/25\/random-401-unauthorized-errors-on-sharepoint-2007\/"},"modified":"2010-06-25T11:29:06","modified_gmt":"2010-06-25T10:29:06","slug":"random-401-unauthorized-errors-on-sharepoint-2007","status":"publish","type":"post","link":"https:\/\/www.peneveyre.com\/en\/2010\/06\/25\/random-401-unauthorized-errors-on-sharepoint-2007\/","title":{"rendered":"Random 401 Unauthorized errors on SharePoint 2007"},"content":{"rendered":"<p><P>When you implement a solution, you test it in different situation and depending on the results, of course, you correct the little mistakes that may be present. What I found very interesting so far&nbsp;in software development is the way to reproduce a behaviour following a given set of steps. For the same steps, you get the same result. That is also a way to qualify a bug or a defect, most of the times.<BR>So, what is more frustrating when the problem or the bug happens randomly ?<BR>However, that is what happened recently on a SharePoint 2007 web site during a roll-out.<\/P><br \/>\n<P>The symptoms ?<BR>Having activated the anonymous access, pages prompted the users for credentials and when no credentials were entered, a simple message &#8220;401 Unauthorized&#8221; was displayed. Now, on that same page, simply pressing F5 to refresh was loading and displaying the page correctly.<\/P><br \/>\n<P>Checks ?<BR>Checked that all the resources were accessible by anonymous users, being CSS, images, documents, etc. Some images were referenced using absolute URLs, but apart from that, nothing special.<BR>Checked in the Windows Event Log, absolutely nothing related to this problem.<BR>Checked the ULS, crawled megs of text files, several &#8220;excessive number of SPRequest&#8221; messages were present, but they were here before the roll-out as well. The only clue was some &#8220;Access denied&#8221; messages, but, no reference to a resource or no stack trace.<BR>Checked also the web.config, everything was ok. And anyway, this is normally handled by SharePoint.<BR>Checked the IIS Directory Security permissions, verifying the identity of the user used by the application pool, but here again, everything was normal.<BR>Custom code doing a forbidden action ? After a complete removal of the three custom controls, the problem persisted, so, it was not that.<BR>After hours and hours of investigation, I found one thing. The Master Page and Page Layouts gallery was not accessible anonymously, so I fixed this first, but still, the 401 issue was still here. Being in the library I decided to check the content of the master pages and the page layouts and found couple of &#8220;__designer&#8221; tags referencing resources. We indeed used the SharePoint Designer to apply some changes, but never had this problem before. But, to be sure and to definitely clean these files, every &#8220;__designer&#8221; tags have been removed and pages provisionned again.<\/P><br \/>\n<P>The result ?<BR>Everything was fine. So, for some reasons, the tags added by SharePoint Designer seem to cause access issues, but not all the times.<BR>In this particular case, what was really annoying is that nothing can lead you to the solution or where the problem is located. A <A href=\"http:\/\/www.google.com\/search?hl=en&amp;source=hp&amp;q=sharepoint+2007+random+401&amp;cts=1277461873584&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=\">lot of people wrote about 401 random issues<\/A>, caused by either a hotfix applied here or load-balancer problems there, but mine was still another one.<BR>So, before spending hours or days looking for useless (in that specific situation) logs, check your master page or your page layouts and remove &#8220;__designer&#8221; tags. Check also that they are accessible anonymously.<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you implement a solution, you test it in different situation and depending on the results, of course, you correct the little mistakes that may be present. What I found very interesting so far&nbsp;in software development is the way to reproduce a behaviour following a given set of steps. For the same steps, you get [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-1983","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/posts\/1983","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/comments?post=1983"}],"version-history":[{"count":0,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/posts\/1983\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/media?parent=1983"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/categories?post=1983"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peneveyre.com\/en\/wp-json\/wp\/v2\/tags?post=1983"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}