怀疑我在asp.net中的C#编码 [英] Doubt in my C# codings in asp.net

查看:85
本文介绍了怀疑我在asp.net中的C#编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的asp.net网页上显示系统的IP地址 所以,我写这个编码



I want to show ip address of the system in my asp.net web page So, i write this coding

<br />
 lbl_ip1.Text =HttpContext.Current.Request.UserHostAddress;<br />
 lbl_ip2.Text =HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];<br />
 lbl_ip3.Text =HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];<br />



但是它应该显示我的IP地址





请一些人帮我......!

推荐答案

您好Sathishyadhuv,



对于初学者来说应该没问题,让我解释一下关于这些的一点点:



UserHostAddress只会尝试获取客户端的主机地址。



REMOTE_ADDR相同

但是在您有 NAT框的情况下可能会出现此问题或代理服务器



如果您必须拥有客户身份(IP)然后你应该考虑使用X.509



如果你想获得一些关于你的情况的具体信息,请提供更多细节

例如

每个人展示什么?

你使用的净星座是什么?



干杯,

Edo
Hi Sathishyadhuv,

That should be ok for starters, let me explain a lill-bit about those:

UserHostAddress will simply try to get the host address of the client.

Same for REMOTE_ADDR
But the problem may occur in situations where you have a NAT box or Proxy Server

If you HAVE to have the client identity (IP) then you should consider using X.509

If you want to get some specific info about your situation, please provide more details
e.g.
What does each one show?
What is the net constellation you are using?

Cheers,
Edo


这篇关于怀疑我在asp.net中的C#编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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