如何使用webrequest 用异步的方式的得到一个网页的文本
解决方案 »
- 三层架构中objectdatasource如何获取BLL层返回的值?
- DataList 里的DropDownList
- 有关Asp.net 页面打印的问题
- 在access数据库里,如何计算某个字段值的总和
- web文件下载,如何不弹出filedialog,直接保存到client的c盘根目录,50分
- 一个关于SMTP的问题
- 母版调用出现的问题,请大家帮忙解决?
- 大家好!我不会用.net发送E-Mail.帮帮我好吗?
- 如何取得http页面的状态码啊
- 从一个页的Button事件中如何获取在iframe中另一页中选种checkbox的值?
- 如何使sqlserver int主键列自动递增(不是标识符)?
- 哪位给推荐本asp.net(中文版,c#)电子书&下载地址--[注;宁缺勿滥]
// Create an instance of the RequestState and assign the previous myHttpWebRequest
// object to it's request field.
RequestState myRequestState = new RequestState();
myRequestState.request = myHttpWebRequest;
// Start the asynchronous request.
IAsyncResult result=
(IAsyncResult) myHttpWebRequest.BeginGetResponse(new AsyncCallback(RespCallback),myRequestState); // this line impliments the timeout, if there is a timeout, the callback fires and the request becomes aborted
ThreadPool.RegisterWaitForSingleObject (result.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), myHttpWebRequest, DefaultTimeout, true); // The response came in the allowed time. The work processing will happen in the
// callback function.
allDone.WaitOne();
// Release the HttpWebResponse resource.
myRequestState.response.Close();