Re: Using Windows Authentication in ASP.NET - Adding properties to users
- From: "Alexey Smirnov" <alexey.smirnov@xxxxxxxxx>
- Date: 27 Feb 2007 01:14:14 -0800
On Feb 27, 9:32 am, "Matt Adamson" <Adamson_Matt...@xxxxxxxxxxx>
wrote:
Guys,
I'm unsure how to use windows authentication in an intranet application. I'd
like to user existing windows account to identify users however the issue I
have is how to then add settings to those users and map them to roles.
If I'd like to restrict the windows users which log on and what tasks they
can perform in the application how should I do this? Presumably I'd need one
user to log in initially and perform admin type tasks e.g. assign windows
users permissions to use the application, how should I do this? How do I
create the first user who can log in?
Best Regards
Matt
It depends on where do you want to have the user roles.
If you want to have the roles in the intranet application
Set the authentication mode to "Windows" and use the
User.Identity.Name property to identify your user. In the application
make a database with users/roles and query that database to set the
roles. For example it can be done in the global.asax within the
AuthenticateRequest
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As
EventArgs)
If Request.IsAuthenticated = True Then
Dim roles() As String
..... code to assign roles() here........
Context.User = New GenericPrincipal(Context.User.Identity, roles)
End If
End Sub
After that you will be able to find if the user has rights or not
using if User.IsInRole("marketing_admin") then....
Something like this.
.
- Follow-Ups:
- Re: Using Windows Authentication in ASP.NET - Adding properties to users
- From: Matt Adamson
- Re: Using Windows Authentication in ASP.NET - Adding properties to users
- References:
- Using Windows Authentication in ASP.NET - Adding properties to users
- From: Matt Adamson
- Using Windows Authentication in ASP.NET - Adding properties to users
- Prev by Date: Datagrid fails to show data!
- Next by Date: Use of Temporary ASP.Net Files foler.
- Previous by thread: Using Windows Authentication in ASP.NET - Adding properties to users
- Next by thread: Re: Using Windows Authentication in ASP.NET - Adding properties to users
- Index(es):
Relevant Pages
|
Loading