using (WebResponse response = webRequest.GetResponse())
{
using (var reader = new StreamReader(response.GetResponseStream()))
{
string tmpStreamData = string.Empty;
while (!reader.EndOfStream)
{
while (reader.Peek() > -1)
{
tmpStreamData += (char)reader.Read();
}
}
MessageBox.Show(tmpStreamData);
}
}
Sometimes I get ? symbols in the "tmpStreamData". Is it possible to avoid such situations and get data in the readable format?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…