aspx不显示ViewState的实例
程序员文章站
2024-03-02 18:31:10
复制代码 代码如下:system.io.stringwriter html = new system.io.stringwriter();  ...
复制代码 代码如下:
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);
推荐阅读
-
aspx不显示ViewState的实例
-
将选择的图片显示在listview中,并显示filename,path和type的简单实例
-
IIS 浏览aspx页面出现无法显示XML页的解决方法分享
-
Android可循环显示图像的Android Gallery组件用法实例
-
asp.net实现上传文件显示本地绝对路径的实例代码
-
将选择的图片显示在listview中,并显示filename,path和type的简单实例
-
IIS 浏览aspx页面出现无法显示XML页的解决方法分享
-
PHP 读取大文件并显示的简单实例(推荐)
-
php+jquery+html实现点击不刷新加载更多的实例代码
-
Winform 显示Gif图片的实例代码