Windows Authentication

  • Thread starter Erik van Kruiselbergen
  • Start date
E

Erik van Kruiselbergen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top