473,748 Members | 5,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2947

"Saradhi" <up*******@inoo ga.com> wrote in message
news:uT******** ******@TK2MSFTN GP12.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.Use rDomainName
and
Environment.Mac hineName

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*******@inoo ga.com> wrote in message
news:uT******** ******@TK2MSFTN GP12.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*******@inoo ga.com> wrote in message
news:e9******** ******@TK2MSFTN GP10.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.Director yServices 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.Director yServices
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
1918
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 System.Globalization.CultureInfo("de-DE") string name= culture.Name; // Produces "de-DE" string s = (3.5).ToString(culture); // produces "3.5". Should produce "3,5" string t = (new System.DateTime()).ToString("T",culture); // produces "2/16/2004". Should produce "16.2.2004" ...
8
10014
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 the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
2
2417
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 logged in, and what network domain they are logged into. And for our environment here (logged into a domain), it seems to work just fine.
1
4708
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 like forever. I have the Access 2002 Developer's Handbook, and I am trying to learn from the example provided in Chapter 2, but I am running into the following problem. I set an admin password and a username and password on the backend,
8
28662
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 Environment.UserName will give the user name of the user that is running the program. Any help would be appreciated, this is giving me a headache.
6
4420
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: vbscript:
33
11862
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 (NT_AUTHORITY\SYSTEM). I understand that when the service starts, no user may be logged in, but that's ok, as the app I am monitoring can only be run by a logged in user. Do I need to use WMI to get the user context of Explorer.exe or is there a...
3
2691
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 is accessed through a Citrix environment. I've implemented an inactivity timer that still doesn't seem to get the job done. Any ideas?
1
1775
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. domain user name). actually once i run exe file the generated file name is according to user itself for eg if "xyz" is a domain user who logged into domain and if he access the php script (remember php script is calling exe file) the final...
0
9544
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4606
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.