Ask a Question related to ASP.NET Security, Design and Development.
-
VIC #1
Forms Authentication with roles from table
Hi,
This is really driving me crazy...
I'm working on a web application with different functionality for users in
different roles.
These roles are not Windows accounts!
All user-information is stored in a table. A user-record contains ID,
username, password and role.
All web pages necessary for each role is stored in a special subfolder,
named as the role-name (to keep it simple :).
So, all functionality for role "001", "002", "003", etc. are stored in
respectively subfolders "login/001", "login/002", "login/003", etc.
The database programming is no problem, but how should my web.config looks
like?
I made several Location tags like:
<location path="login">
<system.web>
<authorization>
<deny users="?" />
</authorization>
</system.web>
</location>
<location path="login/001">
<system.web>
<authorization>
<allow roles="001" />
<deny roles="002,003,004,005"
users="?" />
</authorization>
</system.web>
</location>
<location path="login/002">
<system.web>
<authorization>
<allow roles="002" />
<deny roles="001,003,004,005"
users="?" />
</authorization>
</system.web>
</location>
etc.
Based on a sample from
[url]http://aspnet.4guysfromrolla.com/articles/082703-1.aspx[/url] I wrote the next
code after successful authentication:
Dim sUserRoles(0) As String, sUserNameFromDB, sRoleFromDB As String
sUserRoles(0) = sRoleFromDB
HttpContext.Current.User = New GenericPrincipal(User.Identity, sUserRoles)
FormsAuthentication.RedirectFromLoginPage(sUserNam eFromDB, False)
I can't get it work, what I'm doing wrong???
Has it something to do with the order of the Location-tags in web.config?
Any advise is appreciated, thanks in advance!
Regards,
VicWare
Email: [email]info@vicREMOVE-MEware.nl[/email]
VIC Guest
-
Form Authentication - Roles - Always returns to login screen
I'm using forms authentication and I want to limit access to certain directories only to users with certain roles. I have the following code... -
Custom Roles w/ Windows Authentication?
I have a need to define roles at the web application level, but still use Windows Authentication. I want the application to authenticate the user... -
Forms Authentication based on roles.
HI, I have the following problem. I am making a portal of DJs. The djs must have a Menu, the administrator another menu. I created 2 directories... -
Forms authentication using database table
I'm trying to locate examples on storing usernames and passwords in a database table for Forms authentication. Database can either be oracle or... -
forms auth and roles
You probably already found your answer, but I'll post an answer for anyone else stumbling across this thread. Sorry, you'll have to perform any...



Reply With Quote

