打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
aspx不显示ViewState的实例
代码如下:
System.IO.StringWriter html = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter tw = new System.Web.UI.HtmlTextWriter(html);
base.Render(tw);
string Temp = html.ToString();
string s1 = string.Empty, s2 = string.Empty, s3 = string.Empty, s4 = string.Empty, s5 = string.Empty, s6 = string.Empty;
int i = 0;
int j = 0;
i = Temp.IndexOf("<form");
if (i > 0)
{
j = Temp.IndexOf(">", i);
s1 = Temp.Substring(0, i);
s2 = Temp.Substring(j + 1, Temp.Length - j - 1);
}
i = s2.IndexOf("<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\"");
if (i > 0)
{
j = s2.IndexOf(">", i);
s3 = s2.Substring(0, i);
s4 = s2.Substring(j + 1, s2.Length - j - 1);
}
i = s4.IndexOf("<input type=\"hidden\" name=\"__EVENTVALIDATION\" id=\"__EVENTVALIDATION\"");
if (i > 0)
{
j = s4.IndexOf(">", i);
s5 = s4.Substring(0, i);
s6 = s4.Substring(j + 1, s4.Length - j - 1);
Temp = s1 + s3 + s5 + s6;
}
else
{
Temp = s1 + s3 + s4;
}
Temp = Temp.Replace("</form>", "");
Temp = Temp.Replace("\r\n", "");
tw.Close();
Response.Write(Temp);
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
使用c#发送邮件
StringUtils工具类的使用--JavaEE开源博客-阿Q
asp.net编写登录验证码代码-程序开发-红黑联盟
工具类生成mybatis的Mapper类和xml文件以及实体
unity多语言本地化
关于日期格式转换类
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服