SharePoint: 403 Error Using Embedded Resources

I encountered an issue yesterday using embedded resources in a .NET 2.0 WebPart consumed by SharePoint. The dll used by the webpart contained an embedded js and css file that was accessed by this.Page.ClientScript.GetWebResourceUrl (note dll was deployed to 80\bin).

Whenever a page containing the webpart was accessed first by a non-admin user after an app pool recycle, a 403 error was encountered. This error went away to all users once an admin user had viewed the webpart. This error implied to me that the appropriate safecontrol assembly setting in the web.config was not correct, however this was not the case.

I have not yet found a proper solution to this problem, however the workaround I am currently using  is to call GetWebResourceUrl via SPSecurity.RunWithElevatedPrivileges. I will update this post if and when I find the actual cause / solution to this problem.

Related Link:

http://www.katriendg.com/aboutdotnet/2007-6-webresources-webpart-403-forbidden.aspx

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>