如何使用Asp.net跟踪系统IP地址? [英] How to trace system IP Address Using Asp.net ?

查看:82
本文介绍了如何使用Asp.net跟踪系统IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Asp.net跟踪系统IP地址使用编码任何一个帮助帮助我?

How to trace the system IP Address using Asp.net With coding any one help help me ?

推荐答案

using System;
using System.Web;

namespace WebApplication1
{
    public class Global : HttpApplication
    {
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            // Get request.
            HttpRequest request = base.Request;
    
            // Get UserHostAddress property.
            string address = request.UserHostAddress;
    
            // Write to response.
            base.Response.Write(address);
    
            // Done.
            base.CompleteRequest();
        }
    }
}





也可以参考,

http://stackoverflow.com/questions/20027411/如何获取用户ip-address-in-asp-net [ ^ ]

http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address -in-asp-net [ ^ ]



-KR



and refer this as well,
http://stackoverflow.com/questions/20027411/how-to-get-user-ip-address-in-asp-net[^]
http://stackoverflow.com/questions/735350/how-to-get-a-users-client-ip-address-in-asp-net[^]

-KR


这篇关于如何使用Asp.net跟踪系统IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆