Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi there

i'm trying to build a page for my company's intranet. The general idea of the page is that we replace the logon page to the intranet options with a page that reads your windows logon details.

Anyway we have Many different parts to the options page and we only want certain users to be able to access certain parts. To do this we want to create a seperate user group for each button in the options menu, and only make the user a member of the groups we want them to be able to access.

At the moment i cannot work how to get user groups for a username. I can get the username fine, but getting what windows groups it is a member of i cannot work out how to do.

How does the data come out of this statement, does it come out as a string that needs to somehow divided to get the individual groups, or do you feed in group names and the statement tells you whether the user is a member.

Posted

You can use the .NET role-based security related classes to see if the

current logged in user is in the administrators role.

 

Try this code:

'Place the following Imports statements at the top of the module:

Imports System.AppDomain

Imports System.Threading

Imports System.Security

 

Dim fIsAdministrator As Boolean

Dim wp As Principal.WindowsPrincipal

 

 

CurrentDomain.SetPrincipalPolicy(Principal.PrincipalPolicy.WindowsPrincipal)

wp = CType(Thread.CurrentPrincipal, Principal.WindowsPrincipal)

fIsAdministrator = wp.IsInRole("BUILTIN\administrators")

MsgBox(fIsAdministrator)

 

See

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm

l/cpconcreatingwindowsidentitywindowsprincipalobjects.asp (and related

surrounding "Securing Applications" topics) for more information.

Glenn "Mykre" Wilson, DirectX MVP

Inner Realm

Managed DirectX and Game Programming Resources

  • 1 year later...
Posted
Hi there

i'm trying to build a page for my company's intranet. The general idea of the page is that we replace the logon page to the intranet options with a page that reads your windows logon details.

[...] I can get the username fine, [...]

QUOTE]

 

Hi,

I have this problem, too. I don't know how retrive windows logon details. Can you help me?

 

Christian

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...