Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have restored my SharePoint 2010 site to a new web application. My site collection has two visual web parts on two different pages. I have 10 users who access my site. After restoring my site to a new web application, all of the 10 users (except site collection administrators) are forbidden to access the two pages that have visual web part despite of granting the users contribute level permission. But as soon as I retract those web parts from Central Admin 2010, the two pages containing web parts become accessible to all the users.

Thanks in advance.

share|improve this question
    
Friends, I got the solution... Images were stored in "C:\inetpub\wwwroot\wss\VirtualDirectories\4444\wpresources" folder that are utilized by the WebPart and the users (except site collection administrators) were having only read access to that "wpresources" folder. Hence by assigning Full control to other users solved my problem and the pages became accessible to every non-site collection administrators. –  Zakir HC Apr 13 '12 at 11:27

2 Answers 2

By the sounds of it, the 2 webparts are trying to either extract or display content from parts of the site which the users don't have access to.

Could you please elaborate what kind of content these webparts are displaying?

share|improve this answer
    
These web parts are displaying .net 3.5 chart controls –  Zakir HC Apr 13 '12 at 11:19
    
Thanks Dandroid for your reply... :) –  Zakir HC Apr 13 '12 at 11:22
    
Friends, I got the solution... Images were stored in "C:\inetpub\wwwroot\wss\VirtualDirectories\4444\wpresources" folder that are utilized by the WebPart and the users (except site collection administrators) were having only read access to that "wpresources" folder. Hence by assigning Full control to other users solved my problem and the pages became accessible to every non-site collection administrators. –  Zakir HC Apr 13 '12 at 11:26

This is often because the webparts are attempting to access lists or areas of the site that the current user is not permitted to access. This can be resolved by ensuring that the webpart code to access the content is run with elevated user permissions as the System Account. This can be achieved by using the following block of code;

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPSite site = new SPSite(web.Site.ID))
    {
    // implementation details omitted
    }
});

Also, if your already using this elevated approach make sure that any lists or items that you are referencing come from a web object that was instantiated within the elevated block. Otherwise, the elevated security permissions are not applied to objects your are working with that were created beforehand.

Finally, to ensure you understand exactly what content is causing the permissions error, take the correlation id that the user is shown in the access denied page. Visit the ULS logs in

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS

And open the log file that was generated at the time of the access denied event. Search for the correlation id and you will find a series of log messages which describe exactly which piece of content provoked the access denied message.

Finally, consider installing ULS Log Viewer as it makes the task of reviewing the ULS logs much easier and can display real time feedback on what's happening with the site during a repetition of the problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.