当前位置:编程学习 > C#/ASP.NET >>

C# 刚写的 HttpRequsetResponse 类,异步、事件... 还热乎着呢!(2003-

1.支持Proxy
2.可指定同步或异步
3.一些小修改
//调用示例:
private void button1_Click(object sender, System.EventArgs e)
    {
        HttpRequestResponse xx = new HttpRequestResponse();
        xx.DataArrival += new DataArrivalEventHandler(xx_DataArrival);
        //xx.SendRequest(@"http://localhost:2080/examples/myservlets/servlet2","message=QQ&desttel=13910911925&mytel=13910081138&mypwd=263996211");
        xx.SendRequest(@"http://localhost","message=你好QQ&desttel=13910911925&mytel=13910081138&mypwd=263996211","GET",true);
        xx.SendRequest("http://localhost/quickstart/util/srcview.aspx?path=/quickstart/howto/samples/net/WebRequests/clientGETasync.src","post",false);
    }
private int i=0;
private void xx_DataArrival(object sender, DataArrivalEventArgs e)
    {
        Console.WriteLine( i++);
        Console.Write(e.RecievedData    );
        if (e.IsComplete)
       {
       Console.Write("[" + ((HttpRequestResponse) sender).Request.CookieContainer.GetCookieHeader(((HttpRequestResponse) sender).Response.ResponseUri).ToString() + "]");
补充:asp.net教程,远程及网络应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,