获取ASP.NET中客户端计算机的IP地址 [英] Get IP address of client machine in ASP.NET
本文介绍了获取ASP.NET中客户端计算机的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在ASP.NET中获取客户端机器的IP地址?
解决方案
使用以下内容: -
HttpRequest currentRequest = HttpContext.Current 。请求;
字符串 clientIP = currentRequest.ServerVariables [ REMOTE_ADDR];
您尝试过什么?我什么都没想:(
如何在asp.net(C#)中获取客户端IP。 [ ^ ]
Request.UserHostAddress为您提供客户端的IP地址
How to get IP address of client machine in ASP.NET?
[edit(zorgoz): case corrected]
解决方案
Use the following :-
HttpRequest currentRequest = HttpContext.Current.Request; String clientIP = currentRequest.ServerVariables["REMOTE_ADDR"];
What have you tried? I suppose nothing :(
How to get client IP in asp.net(C#).[^]
Request.UserHostAddress gives you the client''s IP address
这篇关于获取ASP.NET中客户端计算机的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文