• 删除页面中Form下面隐藏的ViewStatue


     1 protected override void Render(HtmlTextWriter writer) 
     2 { 
     3 System.IO.StringWriter html = new System.IO.StringWriter(); 
     4 System.Web.UI.HtmlTextWriter tw = new System.Web.UI.HtmlTextWriter(html); 
     5 base.Render(tw); 
     6 string Temp = html.ToString(); 
     7 string s1 = string.Empty, s2 = string.Empty, s3 = string.Empty, s4 = string.Empty, s5 = string.Empty, s6 = string.Empty; 
     8 int i = 0; 
     9 int j = 0; 
    10 i = Temp.IndexOf("<form"); 
    11 if (i > 0) 
    12 { 
    13 j = Temp.IndexOf(">", i); 
    14 s1 = Temp.Substring(0, i); 
    15 s2 = Temp.Substring(j + 1, Temp.Length - j - 1); 
    16 } 
    17 i = s2.IndexOf("<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE""); 
    18 if (i > 0) 
    19 { 
    20 j = s2.IndexOf(">", i); 
    21 s3 = s2.Substring(0, i); 
    22 s4 = s2.Substring(j + 1, s2.Length - j - 1); 
    23 } 
    24 i = s4.IndexOf("<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION""); 
    25 if (i > 0) 
    26 { 
    27 j = s4.IndexOf(">", i); 
    28 s5 = s4.Substring(0, i); 
    29 s6 = s4.Substring(j + 1, s4.Length - j - 1); 
    30 Temp = s1 + s3 + s5 + s6; 
    31 } 
    32 else 
    33 { 
    34 Temp = s1 + s3 + s4; 
    35 } 
    36 Temp = Temp.Replace("</form>", ""); 
    37 Temp = Temp.Replace("
    ", ""); 
    38 tw.Close(); 
    39 Response.Write(Temp); 
    40 } 
  • 相关阅读:
    P1383 高级打字机
    P1383 高级打字机
    P3723 [AH2017/HNOI2017]礼物 [FFT]
    P3723 [AH2017/HNOI2017]礼物 [FFT]
    P3338 [ZJOI2014]力 [FFT]
    P3338 [ZJOI2014]力 [FFT]
    P2597 [ZJOI2012]灾难
    c语言推箱子 扫雷项目
    蓝桥杯c语言基础题
    c语言的图形库
  • 原文地址:https://www.cnblogs.com/Jin-1007/p/3645365.html
Copyright © 2020-2023  润新知