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

  • SEARCH
  • Home
  • 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 92625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:12:58+00:00 2026-05-10T23:12:58+00:00

We have a PageRoles xml file which contains the page path and the user

  • 0

We have a PageRoles xml file which contains the page path and the user role that can access that page.

We are maintaining a Dictionary in a static class, which gets loaded int static constructor for the class. The class has a method CheckIfRoleAllowed that takes in a page path and returns a bool.

Each page call the CheckIfRoleAllowed on Page Init.

static class PageAccessChecker {  static Dictionary<string, UserRoleType[]> _PageAccessPermissions;  static FileSystemWatcher _XmlWatcher;   static PageAccessChecker()  {    // Load page access permissions from xml    // Set FileSystemWatcher watcher to watch for changes  }   public static CheckIfRoleAllowed(string pagePath)  {  }  } 

Would we be better off doing this using the singleton pattern? If yes, why?

Kind regards.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-10T23:12:59+00:00Added an answer on May 10, 2026 at 11:12 pm

    You do use a singleton. Simply, there are 2 usual implementations for singletons, the other being instantiating the class and having a static member referencing this instance.

    Your implementation makes calls simpler IMO :

    PageAccessChecker.CheckIfRoleAllowed(path); 

    instead of:

    PageAccessChecker._default.CheckIfRoleAllowed(path); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a login.jsp page which contains a login form. Once logged in the
Have you ever tried working with a XAML file which contains thousand tons of
Have a build process that can't be edited and need to pack another war
Have an app that can use tts to read text messages. It can also
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have a Pages table, I have a PagesRoles table with PageId, RoleID that
I can't have asp.net mvc 1.0 to bind HttpPostedFileBase for me. this is my
Have noticed issue while testing iphone app that if one quickly opens/dismisses a modal
Have a look at the menus on this page: http://www.pieterdedecker.be/labs/vspwpg/?page_id=96 They look okay in
have a table that dynamically generates text boxes in run time. I want to

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.