473,385 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Getting Doamin of the User presently Logged in.

Hi All,

Can any one tell me the way to check whether a given user name is a member
of domain users or not. I do not know the domain name as well. I should
retreive from the logged in user, in which user account my appliation is
running. If the system is not a part of domain controller then i should
check for the user name in the current stystem users list.

Can any one give me an example to solve my problem?
I need C# sample code for this one

-SARADHI
Nov 17 '05 #1
4 2932

"Saradhi" <up*******@inooga.com> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
Hi All,

Can any one tell me the way to check whether a given user name is a member
of domain users or not. I do not know the domain name as well. I should
retreive from the logged in user, in which user account my appliation is
running. If the system is not a part of domain controller then i should
check for the user name in the current stystem users list.

Can any one give me an example to solve my problem?
I need C# sample code for this one

-SARADHI


If you need this from a user program running in the interactive logon
session (not a service), you can get the environment variables 'USERDOMAIN'
and 'COMPUTERNAME', if COMPUTERNAME == 'USERDOMAIN' the user is logged on
localy, if they are different, the user is logged on in domain USERDOMAIN.

Check:
Environment.UserDomainName
and
Environment.MachineName

in MSDN
Willy.
Nov 17 '05 #2
Actually, What I want is :
I need to find whether a particualr USERId is the members of a user domain?

For Ex, I have a domain called MyDomain and I logged in as Pardha.
Now I wanted to know whether Ravi is the part of my user domain.

Is there any way we can accomplish this in C#??

-SARADHI


"Saradhi" <up*******@inooga.com> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
Hi All,

Can any one tell me the way to check whether a given user name is a member
of domain users or not. I do not know the domain name as well. I should
retreive from the logged in user, in which user account my appliation is
running. If the system is not a part of domain controller then i should
check for the user name in the current stystem users list.

Can any one give me an example to solve my problem?
I need C# sample code for this one

-SARADHI

Nov 17 '05 #3
Actually, What I want is :
I need to find whether a particualr USERId is the members of a user
domain?

For Ex, I have a domain called MyDomain and I logged in as Pardha.
Now I wanted to know whether Ravi is the part of my user domain.

Is there any way we can accomplish this in C#??
-SARADHI
*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #4

"Saradhi" <up*******@inooga.com> wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
Actually, What I want is :
I need to find whether a particualr USERId is the members of a user
domain?

For Ex, I have a domain called MyDomain and I logged in as Pardha.
Now I wanted to know whether Ravi is the part of my user domain.

Is there any way we can accomplish this in C#??

-SARADHI


Yes it can be done ib C#, check the System.DirectoryServices namespace
classes, but before you do,
make sure you are a bit familiar with ADSI.

I suggest you to start reading this:
Active Directory Technology Backgrounder
and
Introduction to Active Directory Objects

another valuable resource is the platform SDK - System.DirectoryServices
topic (download :
http://www.microsoft.com/downloads/d...DisplayLang=en)

Willy.

Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rerdavies | last post by:
OS: WIndows Server 2003. Currently logged in user is running with German(German) regional settings. Code fragment: System.Globalization.CultureInfo culture = new...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
2
by: Scott M. Lyon | last post by:
I'm having some strange problems with a VB.NET application that I support. The application currently uses SystemInformation.UserName() and SystemInformation.UserDomainName() to determine who is...
1
by: jodyblau | last post by:
I applogize for posting this a second time (I posted in the access-multiuser group as well), but this group seems to respond more rapidly, and I have been trying to figure this out for what seems...
8
by: simonlpwaters | last post by:
I need to obtain the username of the currently logged in user on a machine. However, the program that needs to do this will be running under different credentials to the logged in user, so using...
6
by: =?Utf-8?B?dGhsMTAwMA==?= | last post by:
Hi NG, i need to list the logonHours for a specific user. I'm trying to convert code from vbscript (is working) to vb.net, but the vb.net code does not work. Here are the code listings: 1:...
33
by: JamesB | last post by:
I am writing a service that monitors when a particular app is started. Works, but I need to get the user who is currently logged in, and of course Environment.UserName returns the service logon...
3
by: shayvillere | last post by:
I have an Access 2003 database that is used by around sixty users. Routinely I can't gain access, even late at night after I KNOW that no one is using it. The database is stored on a server that...
1
by: sbettadpur | last post by:
hello i am calling .exe file through my php script. i.e. using exec or system command, i am running exe file that exe file will create on txt file which contains who has logged into domain(i.e....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.