所以......我想在vb.net中获得外部IP ......(不是内部192.168.0.100)而不使用像http://www.whatismyip.com这样的任何链接......所以我做了很多搜索谷歌,我得到了一个代码:
Public Function IpAddress()
Dim strIpAddress As String
strIpAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If strIpAddress = "" Then
strIpAddress = Request.ServerVariables("REMOTE_ADDR")
End If
IpAddress = strIpAddress
End Function
或者
dim blabla as string = Request.ServerVariables("REMOTE_ADDR")
我导入了 sistem.web 和 sistem.net 我也安装了 web 开发工具包和 asp.net *但什么都没有... * 请求未声明
然后我把请求放在前面HttpContext.Current ... HttpContext.Current.request ....
我得到了这个错误: 对象引用未设置为对象的实例