. NET to get the computer name, IP address

Source: Internet
Author: User
IP address in. NET to get a computer name, IP address and the current user name is very simple, the following is a few of my common methods, if you have other good methods, you can reply together:

1. Special properties in asp.net:

Get Server computer name: Page.Server.ManchineName

Get user information: Page.User

Get client computer name: Page.Request.UserHostName

Get client computer IP:Page.Request.UserHostAddress

2. Common methods in Network programming:

Get current computer name: Static System.Net.Dns.GetHostName ()

Remove all IP addresses according to computer name: Static System.Net.Dns.Resolve (computer name). AddressList

The computer name can also be removed according to the IP address: static System.Net.Dns.Resolve (IP address). HostName

3. Common properties of System environment class:

Current computer name: Static System.Environment.MachineName

Current computer-owned domain: static System.Environment.UserDomainName

Current computer User: Static System.Environment.UserName

......................................................................................................

More wonderful to do in. NET



Author blog:http://blog.csdn.net/yolle/
Related articles
Solutions for transaction processing in. Net
DHTML Tips--Abort the submission of a Web page
DHTML tips--Web page text selection
. NET to obtain the computer name, IP address, the current user's method attribute large integration
Get the location code of Chinese characters with. NET (C #)




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.