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 1036671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:44:34+00:00 2026-05-16T14:44:34+00:00

Summary : I need to authorize pages based upon the data present in the

  • 0

Summary: I need to authorize pages based upon the data present in the query string of a url, not just the page name.


Background:

Let’s say I’m building a library inventory system. Users can be created and assigned to a single library in either an Admin or User role. There are hundreds of competing libraries in the same database, so it’s important to ensure that users of one library cannot view inventory from another library.

Right now I’m using a pretty standard ASP.NET setup: Forms Authentication using the SqlMembershipProvider. Authorization using the SqlRoleProvider, configured via <authorization> sections in the web.config. Security trimming with the SiteMap provider to hide unauthorized pages.

To control the inventory information from leaking, I’m manually checking a user’s associate library ID with every inventory query. It works, but it’s tedious and prone to errors. There has to be a better way.

Question:

Now users have the ability to create arbitrary “collections” within a library. (e.g. Collection A has Books 1, 2, & 3 in it.) Admins want the ability to grant Admin / User access on individual collections, not just the entire library.

So, if a user goes to www.com/Book.aspx?BookId=1, the system needs to ensure that user has permissions for the collection that “Book 1” is in before showing the page. If they go to http://www.com/Reviews.aspx?ReviewId=23, I need to make sure the Review is for a book that is in a collection that they have permission to view.

1) How can I implement this in the most standard ASP.NET way possible?
Manual checking within a base page?
A custom HttpModule?
A custom Role Provider?
I’m not interested in how to store the admin/user permissions, but rather how/where to authorize based on those permissions.
(examples on how to implement any of those are appreciated)

2) To further complicate it, I’d still like security trimming to check if the user has Admin rights on any collection or library and hide the admin pages if he doesn’t.

  • 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-16T14:44:34+00:00Added an answer on May 16, 2026 at 2:44 pm

    I wouldn’t handle this anywhere near the UI (ASP.NET) layer but rather within the application services. Something like:

    1. Build services which take an IPrincipal (or your custom user object)
      as a constructor parameter.
    2. When requesting a book/review/whatever, the service is responsible
      for looking to checking to see if the user has access to the
      resource.
    3. If the user doesn’t have access, do some predetermined thing (pass a
      message, throw an exception, return null).

    This will be alot more testable and usable in the long run then worrying about it from the ASP.NET UI side.

    If you have to handle it on the ASP.NET side, I’d consider using a custom IPrincipal and custom RoleProvider to wrap up each library as a role to access, then you could use most of the LoginView, etc. controls.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following EditText preference <EditTextPreference android:key=pref_movies_min_year android:title=@string/pref_movies_min_year android:summary=@string/pref_movies_min_year_summary android:defaultValue=1950/> I need to
I need to have a summary field in each page of the report and
for a data frame as follow id<-c(1,1,2,3,3,2) p<-c(10,0,22,34,0,0) df<-data.frame(id,p) I need a summary table
I need to get summary data from many many rows. The summary fields are
I need to create a SSRS summary report which captures a lot of data
I need to modify my xml node value like <summary> <data>125</data> </summary> to <summary>
I need a SQL query that returns ContactDate, SortName, City, ContactType, and Summary from
I have an SSRS report where I need to collapse data into a summary
Executive summary: I need a way to determine whether a Windows process I've spawned
(Summary: My users need to be able to edit the structure of their dynamically

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.