M
Mark
hey,
i'm trying to get the current windows user and the groups they are in.
Intergrated windows auth on and annoymous access turned off on IIS.
However when trying to compile the following code VS.net doesn't like
the User.IsInRole("domain"); With the error "type or namspace for User
not found".
I can't work out which reference i'm missing!
Basically the idea is to create a auth component that is called for
any authentication/authorization purposes.
Thanks for any help,
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Security.Principal;
//Upon creation of this object set all varables to the current user
CurrentUser = WindowsIdentity.GetCurrent().Name;
isWinAuth = WindowsIdentity.GetCurrent().IsAuthenticated;
//check if the user is in any of these groups
//not the best, but usable
if (User.IsInRole("blah")) UserGroups.Add("blah");
if (User.IsInRole("blah")) UserGroups.Add("blah");
if (User.IsInRole("blah")) UserGroups.Add("blah");
i'm trying to get the current windows user and the groups they are in.
Intergrated windows auth on and annoymous access turned off on IIS.
However when trying to compile the following code VS.net doesn't like
the User.IsInRole("domain"); With the error "type or namspace for User
not found".
I can't work out which reference i'm missing!
Basically the idea is to create a auth component that is called for
any authentication/authorization purposes.
Thanks for any help,
using System;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Security.Principal;
//Upon creation of this object set all varables to the current user
CurrentUser = WindowsIdentity.GetCurrent().Name;
isWinAuth = WindowsIdentity.GetCurrent().IsAuthenticated;
//check if the user is in any of these groups
//not the best, but usable
if (User.IsInRole("blah")) UserGroups.Add("blah");
if (User.IsInRole("blah")) UserGroups.Add("blah");
if (User.IsInRole("blah")) UserGroups.Add("blah");