使用正则Regex来移除网页的ViewState(转)
原文地址:http://www.cnblogs.com/insus/articles/1422675.html
重写Page的Render方法
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter hWriter = new HtmlTextWriter(sw); base.Render(hWriter); string html = sb.ToString(); html = Regex.Replace(html, "<input[^>]*id=\"(__VIEWSTATE)\"[^>]*>", string.Empty, RegexOptions.IgnoreCase); writer.Write(html); }