日期:2014-05-18 浏览次数:20568 次
string PageUrl = "http://www.baidu.com";
System.Net.WebClient wc = new System.Net.WebClient();
wc.Credentials = System.Net.CredentialCache.DefaultCredentials; // 获取或设置用于对向 Internet 资源的请求进行身份验证的网络凭据。
Encoding enc = Encoding.GetEncoding("GB2312"); // 如果是乱码就改成 utf-8 / GB2312
Byte[] pageData = wc.DownloadData(PageUrl); // 从资源下载数据并返回字节数组。
return enc.GetString(pageData);
------解决方案--------------------
你为什么要在OnActionExecuted方法执行呢 在OnResultExecuted()方法执行就可以了啊
OnActionExecuted是在action执行完之后就执行
这个时候result都还没发布 你怎么获取html?