Windows Authentication

From: Erik van Kruiselbergen (evankruiselbergen_at_citco.com)
Date: 11/28/03


Date: Fri, 28 Nov 2003 11:44:12 -0800

I created a database driven web application in asp.net
(c#). Now I need to create queries on the database, based
on the groupmembership of the visiting user.
I can get the login ID of this user by using

String strUID = Request.ServerVariable["LOGON_USER"];

now in VBScript I would do something like this

FUNCTION ISMEMBER(sGroup)
  Dim UserObj,GroupObj
  if IsEmpty(GroupDict) then
    Set GroupDict = CreateObject("Scripting.Dictionary")
    GroupDict.CompareMode = vbTextCompare
    Set UserObj = GetObject("WinNT://" & UserDomain & "/"
& UserLogonID)
    for each GroupObj in UserObj.Groups
      GroupDict.Add GroupObj.Name, "-"
    next
    set Userobj = Nothing
  end if
  IsMember = CBool(GroupDict.exists(sGroup))
end function

A call to the function would look like this.....
  
if IsMember("Internet_Users") then
  <your code here>
end if

Is there a way to do this in ASp.Net using C#??
please help I need an answer urgently.

thanks in advance
Erik