Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 537837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:58:09+00:00 2026-05-13T09:58:09+00:00

I have a custom web application that integrates with a SharePoint (MOSS 2007) solution.

  • 0

I have a custom web application that integrates with a SharePoint (MOSS 2007) solution. I would like to add role-based access to pages in this custom web application, with only users in a specified SharePoint group or with a specific role being able to access them. Other users being sent to the default OOTB web page, giving the message “You Are Not Authorized to View This Page”.

Can anyone point me towards tutorials on how to implement this, and how to control access on each custom page?

Please note, these pages are part of the custom web application, and are NOT created via the SharePoint API or interface.

Thanks, MagicAndi.

Update

Just to make you aware, I am hoping for a solution where we can make use of the SharePoint functionality to extend security trimming or item permissions to limit access to the custom web application pages. I already have code to check a user’s SPGroup on page load, and to redirect if required. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:58:09+00:00Added an answer on May 13, 2026 at 9:58 am

    I have a similar setting on my current project, I changed it a bit to make more sense to your question, we use a base class for custom webpages, something like:

    public abstract class WebPageBase : Page
    {
        public SPBasePermissions PagePermissionFlag;
        public override void OnInit(EventArgs e)
        {
            SPWeb web = SPContext.Current.Web;
            if(!web.DoesUserHavePermissions(PagePermissionFlag))
            {
                // build the access denied page
                SPUtility.Redirect(SPUtility.AccessDeniedPage + "?Source=" + SPHttpUtility.UrlKeyValueEncode(web.Site.MakeFullUrl(Request.RawUrl)),
                                   SPRedirectFlags.RelativeToLayoutsPage,
                                   HttpContext.Current);
            }
    } }

    Then on the page itself, the permission is defined:

    public class ContentPage : WebPageBase
    {
        protected void Page_PreInit(Object sender, EventArgs e)
        {
            PagePermissionFlag = SPBasePermissions.ViewFormPages;
        }
    }
    

    Note: you can also set that on the:

    <%@Page PagePermissionFlagString="SPBasePermissions.ViewFormPages"%> *

    * you will have to convert the string to the enum in the WebPageBase)

    Just for reference, this extra bit is unrelated to the implementation above, its how we use it internally:

    public static class CurrentUser
    {
        public static bool IsAdmin
        {
            get
            {
                return SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.ManageWeb);
            }
        }
    
        public static bool IsReader
        {
            get
            {
                return SPContext.Current.Web.DoesUserHavePermissions(SPBasePermissions.ViewFormPages);
            }
        }
    }
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to have a custom web part page in SharePoint 2007. I
I have a SharePoint 2010 web application that I'd like to use a custom
We have a custom PHP/MySQL web application that gets updated and copied (using SFTP)
I'm working on a web application that will have a custom UI for the
I have a custom HttpModule rewrite engine in an existing web application project that
We have a web application that has custom errors turned on so that users
I have a custom navigation menu for my SharePoint intranet web application which is
I have a custom Sharepoint 2010 web part that runs the user through a
I have an ASP.NET MVC web application that implements a custom membership provider. The
We have a custom master page that is deployed to the MySite web application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.