如何在ASP.NET网站中从Web服务器查找客户端IP地址 [英] How to find the Clients IP address from Web Server in ASP.NET website

查看:123
本文介绍了如何在ASP.NET网站中从Web服务器查找客户端IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨''

我在ASP.NET开发了一个网站

根据IP系统地址

网站正在运行。

当我从本地主机运行网站时工作正常。

但是当我我正在从网络服务器端浏览网站。

我没有得到系统的正确IP地址

它正在浏览。

i我正在使用以下代码来获取系统的IP地址

Hi''
I have developed a website in ASP.NET
In which I am performing some Task
According to the IP address of the system
Where the site is Running.
Its working Fine When I am Running the Site from Local Host.
But when I am browsing the Site from web server end.
I am not getting the Correct IP address of the System where
it is getting browsed.
i am using folowing code to fetch the Ip Address of the System

strHostName = System.Net.Dns.GetHostName()
strIPAddress = System.Net.Dns.GetHostEntry(strHostName).AddressList(0).ToString()



有没有其他方法可以找到系统的IP地址,

请协助


is there any other method to find the IP address of System,
please Assist

推荐答案

试试这个





Try this


StrIPAdd = Request.ServerVariables("REMOTE_ADDR") 


这篇关于如何在ASP.NET网站中从Web服务器查找客户端IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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