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 custom application page, now what I want to do, is to allow users ( or SPGroup ) to view and use application page. How this should be done ? Currently only administrator can view application page, other users can't.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

I finally figure this out. The problem was that I was accessing SPSite and SPWeb objects, and users didn't have permissions to interact with this objects. So I had to wrap SPSite and SPWeb object calls into SPSecurity.RunWithElevatedPrivileges. Now everything works as exepcted.

share|improve this answer
add comment

Please make sure that you have in your codebehind

 protected override bool RequireSiteAdministrator {
    get { return false; }
  }

Then in your Init event, you can check if the current user is member of a specific group that you trust and if it's not the case, you can use the SPUtility.TransferToErrorPage("Your relevant access denied message")

share|improve this answer
    
Hi, I have added RequireSiteAdministrator in code-behind, but I still got the same error ( Access is denied ). I'm not checking anything in Init method as you proposed ( not yet ) I just want to make sure that users other than admin can access my page as well. Any other ideas ? –  michael moore Mar 25 '12 at 9:32
    
Can you give us an overview of your code to check which class you're inheriting ? It might be an administration page rather than an application page. –  Francois Verbeeck Mar 25 '12 at 11:23
    
It's application page, here is definition public partial class Reports : LayoutsPageBase { } –  michael moore Mar 25 '12 at 13:45
add comment

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.