-1

I'm using SQL Server and a C# Webforms application.

Inside a table, I want to specify usergroup and in front of each group names of accessible pages.

So inside the web application, I search inside masterpage using stored procedure if each entered webform if user can access it or not.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Melody Magdy
  • 148
  • 3
  • 11
  • That's not typically a good idea. What if a page gets renamed or moved. Instead consider using user roles to restrict access to specific locations. Here are some links to read further. MembershipProvider https://msdn.microsoft.com/en-us/library/yh26yfzy.aspx and location based access rules https://weblogs.asp.net/gurusarkar/setting-authorization-rules-for-a-particular-page-or-folder-in-web-config – bic Jun 17 '17 at 21:16

1 Answers1

0

You could create a table like so:

create table UserGroupToPage
(
    Id int identity(1, 1) primary key,
    PageName varchar(100) not null,
    UserGroupId int not null foreign key references UserGroup (Id)
)

Or, if you have your page names in a table:

create table UserGroupToPage
(
    Id int identity(1, 1) primary key,
    PageId int not null foreign key references Pages (Id),
    UserGroupId int not null foreign key references UserGroup (Id)
)

But - as bic said - you would need to update page names if you change them in your app.

IngoB
  • 2,552
  • 1
  • 20
  • 35
  • Also note that you would have to store the complete relative path in the UserGroupToPage table, not just the PageName itself. – bic Jun 17 '17 at 21:42