乱码问题

haihuan23 haihuan23 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

public partial class Search : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(GetUrlData("http://www.google.com.hk"));
}

public string GetUrlData(string url)
{
System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);
System.Net.WebResponse webResponse = webRequest.GetResponse();
System.IO.Stream iStream = webResponse.GetResponseStream();
System.IO.StreamReader sr = new System.IO.StreamReader(iStream, System.Text.Encoding.Default);
string str = sr.ReadToEnd();
sr.Close();
iStream.Close();
webResponse.Close();
return str;
}
}





System.Text.Encoding.ASCII UTF8 等都尝试过,都是乱码。。请教各位
...全文
评论 14
收藏 已收藏
分享
返回顶部
haihuan23
.NET社区 62,275 成员 668,967 内容