日期:2014-05-19  浏览次数:21024 次

如何获取本机IE浏览器发送出去的Form表单信息
设某页面,mail.XXX.com页面当中,有一个Form表单,顾客填好信息以后,点击提交以后,如何获取到这个表单的信息?

------解决方案--------------------
以前找的代码,贴给你看,可以研究一下.我用它做过类似的东西.


/// <summary>
/// MyTryRaw 的摘要说明。
/// </summary>
public class MyTryRaw
{
#region Attributes
private bool error_occurred; //套接字在接收包时是否产生错误
private static int len_receive_buf; //得到的数据流的长度
private byte[] receive_buf_bytes = null; //收到的字节
private Socket socket = null; //声明套接字
private const int SIO_RCVALL = unchecked((int)0x98000001); //监听所有的数据包
public static bool isStop = false;

public Socket m_socket
{
get
{
return socket;
}
}

#endregion

#region Events
public delegate void PacketArrivedEventHandler(Object sender, PacketArrivedEventArgs args);

public event PacketArrivedEventHandler PacketArrival;
#endregion

#region OnEvents
protected virtual void OnPacketArrival(PacketArrivedEventArgs e)
{
if (PacketArrival != null)
{
PacketArrival(this, e);
}
}

#endregion

#region Constructor
public MyTryRaw()
{
//
// TODO: 在此处添加构造函数逻辑
//
len_receive_buf = 4096;
receive_buf_bytes = new byte[len_receive_buf];
//PacketArrival += new PacketArrivedEventHandler(MyTryRaw_PacketArrival);

}
#endregion

#region Functions

public void BindSocket()
{
//IPAddress ipAddress = IPAddress.Parse( "192.168.10.233 ");
//this.socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
//Console.WriteLine( "Start bind! ");
//try
//{
// socket.Blocking = false;
// socket.Bind(new IPEndPoint(ipAddress, 80));
//}
//catch (Exception E)
//{
// throw (E);
//}
socket = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
socket.Blocking = false;  //置socket非阻塞状态
socket.Bind(new IPEndPoint(IPAddress.Parse( "192.168.0.110 "), 0)); //绑定套接字

if (SetSocketOption() == false) error_occurred = true;

Console.WriteLine( "Bind success! ");
}

public bool SetSocketOption()
{
bool ret_value = true;
try
{
//低级别操作模式,接受所有的数据包,这一步是关键,必须把socket设成raw和IP Level才可用SIO_RCVALL
socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.HeaderIncluded, 1);
byte[] IN = new byte[4] { 1, 0, 0, 0 };
byte[] OUT = new byte[4];

int ret_code = socket.IOControl(SIO_RCVALL, IN, OUT);
ret_code = OUT[0] + OUT[1] + OUT[2] + OUT[3];//把4个8位字节合成一个32位整数
if (ret_code != 0) ret_value =