chao's profile清凉水都PhotosBlogListsMore Tools Help

Blog


    September 17

    .NET获取IP等信息 - jenner-lin - 博客园

     

    .NET获取IP等信息

    .NET获取IP等信息

    1. 在ASP.NET中专用属性:
    获取服务器电脑名:Page.Server.ManchineName
    获取用户信息:Page.User
    获取客户端电脑名:Page.Request.UserHostName
    获取客户端电脑IP:Page.Request.UserHostAddress
    2. 在网络编程中的通用方法:
    获取当前电脑名:static System.Net.Dns.GetHostName()
    根据电脑名取出全部IP地址:static System.Net.Dns.Resolve(电脑名).AddressList
    也可根据IP地址取出电脑名:static System.Net.Dns.Resolve(IP地址).HostName

    3. 系统环境类的通用属性:
    当前电脑名:static System.Environment.MachineName
    当前电脑所属网域:static System.Environment.UserDomainName
    当前电脑用户:static System.Environment.UserName

    .NET获取IP等信息 - jenner-lin - 博客园

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://ebakeshop.spaces.live.com/blog/cns!1A66D6C80502E805!318.trak
    Weblogs that reference this entry
    • None