Thursday, March 13, 2008

403 Forbidden or Access Denied message in Sharepoint 2007

I had very strange problems with Error 403 in MOSS 2007 application. I integrated the ascx controls in sharepoint aspx page. At first I added the MyControl.ascx and MyControl.ascx.cs files in "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES" folder of all WFE servers and MyClassLib.dll in "bin" directory of the application. The aspx page (with master page) was created in Sharepoint designer 2007 and the control was registered with this line:

%@ Register Src="~/_controltemplates/SearchResult.ascx" TagName="SearchResult" TagPrefix="uc1" %

The interesting moment was, that the page wokred fine for administrative users, but for all other users error 403 appeared. The message in the event log was:

Load control template file /_controltemplates/MyControl.ascx failed: Could not load type 'MyControl'

The solution - I gave read permissions for EVERYONE for the bin folder. I used and filemon tool to catch ACCESS DENIED message for file open in the same folder. After this change all worked fine.