473,398 Members | 2,403 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,398 software developers and data experts.

Get current windows domain name

Hi,

I need to use check the current windows user of the application by using
User.IsInRole(DOMAIN\USERGROUP)

I have knowledge of the usergroup to check on, but since the application
will be installed at different web servers, I cannot be sure of the windows
domain. Is there an easy way to ask for the domain name?

Thanks,
Dorte
Nov 19 '05 #1
2 6882
Dorte,

You can get the domain by including a reference to System.DirectoryServices
and executing the code sample below.

I hope this helps.

-------------------------

DirectoryEntry entry = new DirectoryEntry("WinNT://<servernamegoeshere>");
string domain = entry.Parent.Name;
Console.WriteLine(domain);
Nov 19 '05 #2
Do you mean Environment.UserDomainName ?

On Fri, 17 Dec 2004 03:13:04 -0800, "Dorte"
<Do***@discussions.microsoft.com> wrote:
Hi,

I need to use check the current windows user of the application by using
User.IsInRole(DOMAIN\USERGROUP)

I have knowledge of the usergroup to check on, but since the application
will be installed at different web servers, I cannot be sure of the windows
domain. Is there an easy way to ask for the domain name?

Thanks,
Dorte


Nov 19 '05 #3

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

Similar topics

9
by: Leo Breebaart | last post by:
I am writing a utility in Python and I'd like to add a command-line option "--mailto <address>" that will cause an e-mail summary to be sent to <address> when the utility finishes running. My...
1
by: hch_nguyen | last post by:
I am developing in the .NET Framework using vb.net running under Windows 2000 SP2. I have a snippet of code that runs to determine the name of the current windows user logged in. The code works...
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
6
by: John Dalberg | last post by:
I want to automate the process of logging into an intranet. I want to pull out the username of the Windows user logged into the machine running the browser and use the username in my app. How can I...
4
by: Leszek | last post by:
Hello! I have my webpage (ASP) in domain (IIS 6.0). I need to make a popup with fullname of current user. How can I do this? Maybe someone have any examples? Thanks!
0
by: D-Someone | last post by:
We have an active directory user that just had her username renamed. When the user is running an application that calls our CurrentUser web service method (which returns the value of...
3
by: Lattis | last post by:
I have the following problem: User A is logged in to a windows 2000 terminal. He runs an application which runs under the credentials of a different user. If I try to see the current user...
3
by: Depechie | last post by:
Hey guys, small question. Can I find out if the current logged on use is a local user or a domain user ? And please don't use any solution that uses String parsing... What I need is to get...
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.