Re: Using Windows Authentication in ASP.NET - Adding properties to users



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.

.



Relevant Pages

  • Re: URGENT - Very Puzzled - IIS Authentication
    ... Juan T. Llibre, asp.net MVP ... instruct your users to go to http://sguk-web1 to enter the intranet. ... I have just deployed our shiny new ASP.NET 2 Intranet app and want to use Integrated windows ... authentication at IIS level with "windows" authentication in web.config. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Change in ASP.Net authentication between Win2000 and Win2003
    ... > is turning on/off Kerberos is occuring. ... It control how IE deals with "Authentication: ... when you put IIS6 in a domain and have "Integrated Windows Authentication" ...
    (microsoft.public.windows.server.security)
  • Re: Change in ASP.Net authentication between Win2000 and Win2003
    ... > is turning on/off Kerberos is occuring. ... It control how IE deals with "Authentication: ... when you put IIS6 in a domain and have "Integrated Windows Authentication" ...
    (microsoft.public.inetserver.iis.security)
  • Re: Need help configuring Wireless Connection profile
    ... and I can only use the intel OR windows utility, not both at the same time. ... Windows authentication for all users,4129,LRG\ryanv,4149,Wireless WPA2 ... SMALL BUSINESS SERVER: ... STEP #1 Install Certificate Services ...
    (microsoft.public.windowsxp.general)
  • Re: form authentication and webservices
    ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... We will be using Windows Authentication on the Web Services side (same ... Dominick Baier ...
    (microsoft.public.dotnet.framework.aspnet.security)

Loading