asp.net 生成静态页时如何过滤掉viewstate
本文导语: 代码示例: public static string GetSourceTextByUrl(/blog_article/string url/index.html) { WebRequest request = WebRequest.Create(url); request.Timeout = 200000;//20秒超时 WebResponse response = request.GetResponse(); Stream resStream = response.GetResponseStream(); StreamReader sr = new StreamReader(resStream...
public static string GetSourceTextByUrl(/blog_article/string url/index.html)
{
WebRequest request = WebRequest.Create(url);
request.Timeout = 200000;//20秒超时
WebResponse response = request.GetResponse();
Stream resStream = response.GetResponseStream();
StreamReader sr = new StreamReader(resStream);
string tempstr = sr.ReadToEnd();
Regex r1 = new Regex("", RegexOptions.IgnoreCase);
Regex r2 = new Regex("", RegexOptions.IgnoreCase);
Regex r3 = new Regex("", RegexOptions.IgnoreCase);
//过滤代码
Regex r4 = new Regex("", RegexOptions.IgnoreCase);
Regex r5 = new Regex("");
tempstr = r1.Replace(tempstr, "");
tempstr = r2.Replace(tempstr, "");
tempstr = r3.Replace(tempstr, "");
tempstr = r4.Replace(tempstr, "");
tempstr = r5.Replace(tempstr, "");
return tempstr;
}