473,503 Members | 1,953 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Computername

Hi,

How do i get the domain name and the computer name, e.g. "domain\pc-name" ??

Thank you in advance.
Peter
Jun 27 '08 #1
8 954
System.Enviroment.MachineName
System.Enviroment.UserName
System.Enviroment.UserDomainName

"Peter Larsen [CPH]" <Pe*********@community.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

How do i get the domain name and the computer name, e.g. "domain\pc-name"
??

Thank you in advance.
Peter

Jun 27 '08 #2
Are there orther properties except from those in system.environment ??
/Peter

"Norman Yuan" <Fa******@FakeEmail.Notwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
System.Enviroment.MachineName
System.Enviroment.UserName
System.Enviroment.UserDomainName

Jun 27 '08 #3
Yes, there are more. Why not just go to the .NET documentation or simply
look into Object Browser in Visual Studio?

"Peter Larsen [CPH]" <Pe*********@community.nospamwrote in message
news:ey**************@TK2MSFTNGP05.phx.gbl...
Are there orther properties except from those in system.environment ??
/Peter

"Norman Yuan" <Fa******@FakeEmail.Notwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
>System.Enviroment.MachineName
System.Enviroment.UserName
System.Enviroment.UserDomainName

Jun 27 '08 #4
Why?
"Peter Larsen [CPH]" <Pe*********@community.nospamschreef in bericht
news:ey**************@TK2MSFTNGP05.phx.gbl...
Are there orther properties except from those in system.environment ??
/Peter

"Norman Yuan" <Fa******@FakeEmail.Notwrote in message
news:u8**************@TK2MSFTNGP05.phx.gbl...
>System.Enviroment.MachineName
System.Enviroment.UserName
System.Enviroment.UserDomainName

Jun 27 '08 #5
Because i'm told that system.environment isn't reliable - i want the names
as the domain controller see it.
/Peter

Jun 27 '08 #6
Hi Peter,

Can you tell me why System.Environment is not reliable? Do you have any
sample to demonstrate this?

System.Environment.MachineName gets the Netbios machine name by calling
Win32 GetComputerName() API internally. System.Environment.UserDomainName
property internally calls GetUserNameEx() or LookupAccountName() Win32
security API to get the result. I think they are both reliable. You can get
the [domain name]\[machine name] form, by using these two properties
together. Does it meet your need?

If you have any special concern of using them, please feel free to tell us,
thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 27 '08 #7
Hi Jeffrey,

Thank you for the lesson :-)
Yes it does meet my need.

BR
Peter

""Jeffrey Tan[MSFT]"" <je***@online.microsoft.comwrote in message
news:P6**************@TK2MSFTNGHUB02.phx.gbl...
Hi Peter,

Can you tell me why System.Environment is not reliable? Do you have any
sample to demonstrate this?

System.Environment.MachineName gets the Netbios machine name by calling
Win32 GetComputerName() API internally. System.Environment.UserDomainName
property internally calls GetUserNameEx() or LookupAccountName() Win32
security API to get the result. I think they are both reliable. You can
get
the [domain name]\[machine name] form, by using these two properties
together. Does it meet your need?

If you have any special concern of using them, please feel free to tell
us,
thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support

Jun 27 '08 #8
Hi Peter,

Glad to see this meets your need. If you need further help, please feel
free to feedback, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=========================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 27 '08 #9

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

Similar topics

9
2481
by: vishal | last post by:
i have created one page in asp login.php on my pc it is working as http://localhost/index.php but when i access this page from other computer in network it is not working pls help me ...
2
1444
by: Ryd | last post by:
I'm looking for at asp script that grap the clients computername when they access a local http site. The client and server is in a local domaine.
2
7660
by: dthmtlgod | last post by:
I am attempting to retrieve the computer name of a remote user accessing our websever. I have tried the following and both don't work. Any ideas? Returns the webserver computer name Set...
7
2944
by: Mindy Geac | last post by:
Hello, i'm new with ASP! How can I display the hosting computername on the website, We have 2 servers and I want to know which server I'm getting the asp pages from. thnx, Mindy
2
6576
by: Todd | last post by:
Is there a method I can use in C# that will set the ComputerName? Any Help would be appreciated. Thanks Todd
1
1344
by: Jason Shohet | last post by:
i'm using C#, would like to get the computerName of the machine on a windows2000 network. TY Jason Shohet
2
1812
by: Joseph | last post by:
Has anyone had any experience gathering the local computername through a web application with no client side program. I've been researching different avenues and have been coming up blank so far. ...
0
1210
by: amjad | last post by:
Dear All, I am using Visual Studio beta 2005 beta 2 with ASP.Net 2.0 and C#.I run the application and it work correctly with http://localhost:port/projectname/page but not with...
4
3300
by: Mike Behrendt | last post by:
Hey @all! option explicit on Private Declare Function GetComputerName Lib "kernel32" Alias _ "GetComputerNameA" (ByVal lpBuffer As String) As Long Private Const MAX_COMPUTERNAME_LENGTH...
1
2660
by: usman211 | last post by:
i m using the following code for IP and ComputerName, it run accurately with our LAN but when i run it from some remote/hosting servers(like godaddy where the site is hosted) it get the IP of my...
0
7093
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
7348
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...
0
7467
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...
0
5592
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,...
0
4685
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...
0
3166
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1519
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 ...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
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...

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.