从代理服务器跟踪IP地址 [英] Tracking IP Address from Proxy Server
本文介绍了从代理服务器跟踪IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我需要跟踪连接到代理服务器的计算机的IP地址.我遇到了错误.我的代码如下.
Hi to All,
I need to Track the IP Address of computer that is connected to a proxy server. I am facing an error. I have code stated below.
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.ClientServices.Providers;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
private StringCollection GetIPs()
{
dynamic localIP = new StringCollection();
dynamic localHostName = Dns.GetHostName();
dynamic hostEntry = Dns.GetHostEntry(localHostName);
// Grab all ip addesses.
foreach (System.Net.IPAddress ipAddr in hostEntry.AddressList)
{
localIP.Add(ipAddr.ToString());
}
return localIP;
}
}
}
错误是
Error is
Error 42 The type or namespace name 'dynamic' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\Amul\Desktop\AJAXAMULabcd\STARTPAGE.aspx.cs 40 9 C:\...\AJAXAMULabcd\
请提出.
问候,
Amul V V Wayangankar
Kindly Suggest.
Regards,
Amul V V Wayangankar
推荐答案
您要定位的.Net版本是什么? C#2010中引入了dynamic.
更新:您不能立即使用动态.另外,您根本不需要在发布的代码中使用动态代码.
What is the .Net version you are targeting? dynamic was introduced with C# 2010.
Update: You cannot use dynamic right away then. Also, you simply do not need to use dynamic in the code you have posted.
动态"在C#4.0中定义为上下文关键字.如果您使用的是C#3.0,那么除非您将其定义为动态的,否则您将无法使用动态的.查看更多信息此处 [ ^ ].
"dynamic" is defined as contextual keyword in C# 4.0. If you are using C# 3.0, then you can''t use dynamic unless you define it to be something. See more info here[^].
这篇关于从代理服务器跟踪IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文