下面是我在Microsoft .NET Framework SDK v1.1文档里面找来的一个异步处理(获取网页源代码)
-----------------------------------------------------------------------------------------
public void get_code(string url)

     
try
{
   
WebRequest myWebRequest= WebRequest.Create(url);
RequestState myRequestState = new RequestState();
myRequestState.request = myWebRequest; 
                                    IAsyncResult asyncResult=(IAsyncResult) myWebRequest.BeginGetResponse(new AsyncCallback(RespCallback),myRequestState);
allDone.WaitOne();
myRequestState.response.Close();

}
catch(WebException e)
{
throw e;

catch(Exception e)
{
throw e;
}

}
private  void RespCallback(IAsyncResult asynchronousResult)
{  
try
{
RequestState myRequestState=(RequestState) asynchronousResult.AsyncState;
WebRequest  myWebRequest1=myRequestState.request;
myRequestState.response =  myWebRequest1.EndGetResponse(asynchronousResult);
Stream responseStream = myRequestState.response.GetResponseStream();
myRequestState.responseStream=responseStream;
IAsyncResult asynchronousResultRead = responseStream.BeginRead(myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
    
}
catch(WebException e)
{
throw e;

catch(Exception e)
{
throw e;
}
}
private void ReadCallBack(IAsyncResult asyncResult)
{
try
{
RequestState myRequestState = (RequestState)asyncResult.AsyncState;
Stream responseStream = myRequestState.responseStream;
int read = responseStream.EndRead( asyncResult );
if (read > 0)
{
myRequestState.requestData.Append(Encoding.ASCII.GetString(myRequestState.bufferRead, 0, read));
IAsyncResult asynchronousResult = responseStream.BeginRead( myRequestState.bufferRead, 0, BUFFER_SIZE, new AsyncCallback(ReadCallBack), myRequestState);
}
else
{
if(myRequestState.requestData.Length>1)
{
string sringContent;
sringContent = myRequestState.requestData.ToString();//获得采集的源代码,我向问下在这个异步处理的里面是怎么样来传递参数的
比如:我现在要添加数据到
                                             data.add(string st1,string st2,this.GetTxt(sringContent) )//this.GetTxt是提取文本,现在我想知道的是这里的st1,和st2,怎么样传递进去??
}

responseStream.Close();
allDone.Set();
}
}
catch(WebException e)
{
throw e;

catch(Exception e)
{
throw e;
} }