You could try also to use HttpModule:
- Modify the code in the example app so that the request would know which page is to be requested - obviously you would need the following DbTables structure:
- This link will give you a good start
Now this rough create table statements would give you the following set :
- each user will have one or more UserRoles
- each Page will be configurable to be accessed per UserRole
Some DDL SQL around the idea:
CREATE TABLE [User](
[UserId] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](100) NOT NULL,
[SecondName] [varchar](100) NULL,
[LastName] [varchar](100) NOT NULL,
[DomainName] [varchar](100) NOT NULL,
[UserRoleId] [int] NOT NULL,
[Password] [nvarchar](100) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[UserRole](
[UsersRoleId] [int] IDENTITY(1,1) NOT NULL,
[RoleId] [int] NOT NULL,
[UserId] [int] NOT NULL
) ON [PRIMARY]
CREATE TABLE [ga].[Roles](
[RoleId] [int] IDENTITY(1,1) NOT NULL,
[RoleName] [varchar](50) NOT NULL,
[RoleDefinition] [varchar](1000) NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Page](
[PageId] [int] IDENTITY(1,1) NOT NULL,
[PageName] [varchar](200) NOT NULL,
[PageDescription] [varchar](max) NOT NULL,
[PageTitle] [varchar](50) NOT NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[PagePerUserRole](
[PageForRoleId] [int] IDENTITY(1,1) NOT NULL,
[UserRoleId] [int] NOT NULL,
[PageId] [int] NOT NULL
) ON [PRIMARY]
GO
OR CustomBaseClass
basically the same but would check whether the use has access on some very early event of the asp.net page life cycle - such as OnInit
The latter is more unorthodox way - yet I have written an app using complicating authentication mechanism ( using 3 -rd software system ) and it seems to work for a while in production ; )