473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Setting Roles with Forms Authentication and Access 2003

Ed
Hi

I currently have an asp.NET project. I'm using Access 2003 and forms authentication to authenticate users. Can anyone tell me how to set the roles in asp.NET so that it recognizes them? The logging in portion of my code works...What I need to know is how to allow access to certain pages to users with an administrator role while blocking access to regular users. My database has 3 columns, username, password, and roles. It is the last column that I would like asp.NET to recognize.

Thank you

Ed
Nov 18 '05 #1
2 1426
While I am just starting with ASP.NET, I have used regular ASP so hopefully
this still applies.

In the authentication portion of your code, have it read the role of the
user out of the database and store it in a Session Variable. On the pages
you would like to restrict to Administrator only access, but a check to
verify the user's role that is stored in the Session Variable at the very
beginning of the page load. If the user isn't an Administrator, use the
Redirect to send them into an invalid permissions page or whatever you want
to setup. Finally depending on how your site is designed it would be good
practice to not even show the links to visit the restricted page unless the
Session Variable role is set to an Administator.
"Ed" <an*******@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
Hi,

I currently have an asp.NET project. I'm using Access 2003 and forms authentication to authenticate users. Can anyone tell me how to set the
roles in asp.NET so that it recognizes them? The logging in portion of my
code works...What I need to know is how to allow access to certain pages to
users with an administrator role while blocking access to regular users. My
database has 3 columns, username, password, and roles. It is the last
column that I would like asp.NET to recognize.
Thank you,

Ed

Nov 18 '05 #2
"Ed" <an*******@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com...
Hi,

I currently have an asp.NET project. I'm using Access 2003 and forms

authentication to authenticate users. Can anyone tell me how to set the
roles in asp.NET so that it recognizes them? The logging in portion of my
code works...What I need to know is how to allow access to certain pages to
users with an administrator role while blocking access to regular users. My
database has 3 columns, username, password, and roles. It is the last
column that I would like asp.NET to recognize.

The standard way to do this is to get a list of roles out of your database,
however you would do that. You will then save the list (perhaps as
comma-separated values) in the UserData property of the Forms Authentication
ticket. Then, in the AuthenticateRequest handler in global.asax, you'll pull
the list out of UserData and supply it to the GenericPrincipal constructor.
See HOW TO: Implement Role-Based Security with Forms-Based Authentication in
Your ASP.NET Application by Using Visual Basic .NET
(http://support.microsoft.com/default...b;en-us;306238) for an
example.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: VB Programmer | last post by:
PLEASE HELP.... I'm having trouble. In my login form after I've verified the username/password are valid I do this: Select Case iMyPrivilege Case 0 Dim arrRoles() As String = {"guest"}...
3
by: Sharat Koya | last post by:
Please can you help with a problem I am having. My web config is set to... <authorization><deny users="?"/> <authentication mode="Forms"> <forms name=".COOKIE" loginUrl="login.aspx"...
2
by: Joey | last post by:
I have a web app with many users and their associated values (hashed passwords, first name, last name, etc...) stored in a Microsoft SQL Server 2000 database. My app uses stored procedures and...
5
by: Andrew | last post by:
Hi, I have a default.aspx which allows the user to choose between module Admin and module B. When the user clicks either one, he will be redirected to a FormsAuthentication login page. The...
3
by: charles | last post by:
Hi, I am trying to port my ASP application to ASP.Net 2.0 My application is sold to large corporations that have many thousands of users. So I do not use Forms authentication. To make it more...
4
by: Ben | last post by:
Hi, I defined roles in order to deny access for some pages to anonymous users. I tested it by typing the url of a denied page to test the system (http://denypage.aspx). It works (access...
2
by: trullock | last post by:
Hi, I need to control access to certain pages in my site, via the use of forms based authentication and roles. Now i've got the pages i want protected by a login form and thats all working...
1
by: scottw512 | last post by:
Hi, We have roles defined in web.config and have setup our roles system where we can use User.IsInRole. The problem is that when a page fails a role check, ASP.NET redirects it to the Forms...
1
by: djnokturnal | last post by:
Hey guys/gals, I have successfully implemented forms authentication on my site: <authentication mode="Forms"> <forms loginUrl="/Members/Login.aspx" timeout="20"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.