1
我有一個簡單的webclient連接到網頁並返回數據。代碼如下:簡單的webclient請求返回MS.InternalMemoryStream
try
{
WebClient webClient = new WebClient();
Uri uri = new Uri("https://domain.com/register.php?username=" + txtbUser.Text);
webClient.OpenReadCompleted +=
new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
webClient.OpenReadAsync(uri);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
if (e.Error == null)
{
//Process web service result here
MessageBox.Show(e.Result.ToString());
}
else
{
//Process web service failure here
MessageBox.Show(e.Error.Message);
}
}
從e.Result
到來的數據是MS.InternalMemoryStream
,而不是從網頁回來的數據,從網頁回來的數據應該只是一個0或1。任何想法的?
感謝, 彌敦道
謝謝!每天學些新東西!! – Nathan 2011-06-07 21:03:13