zoukankan      html  css  js  c++  java
  • 重写form里的action

            protected override void Render(System.Web.UI.HtmlTextWriter writer)
            
    {
                
    if(writer is System.Web.UI.Html32TextWriter)
                
    { writer=new FormFixerHtml32TextWriter(writer.InnerWriter);}
                
    else
                
    { writer=new FormFixerHtmlTextWriter(writer.InnerWriter);}
                
    base.Render(writer);
            }

            internal class FormFixerHtml32TextWriter:System.Web.UI.Html32TextWriter
            
    {
                
    private string _url;
                
    internal FormFixerHtml32TextWriter(TextWriter writer):base(writer)
                
    {
                    _url
    =HttpContext.Current.Request.RawUrl;
                }

                
    public override void WriteAttribute(string name, string value, bool fEncode)
                
    {
                    
    if(_url!=null&&string.Compare(name,"action",true)==0)
                    
    {
                        value
    =_url;
                    }

                    
    base.WriteAttribute (name, value, fEncode);
                }

            }


            
    internal class FormFixerHtmlTextWriter:System.Web.UI.HtmlTextWriter
            
    {
                
    private string _url;
                
    internal FormFixerHtmlTextWriter(TextWriter writer):base(writer)
                
    {
                    _url
    =HttpContext.Current.Request.RawUrl;
                }

                
    public override void WriteAttribute(string name, string value, bool fEncode)
                
    {
                    
    if(_url!=null&& string.Compare(name,"action",true)==0)
                    
    {
                        value
    =_url;
                    }

                    
                    
    base.WriteAttribute (name, value, fEncode);
                }

            }

  • 相关阅读:
    [codevs]失恋28天题目系列
    [NOIP1998]最大数
    [codevs4247]奇特的生物
    [codevs1380]没有上司的舞会
    [codevs2152]滑雪
    [codevs2171]棋盘覆盖
    [codevs2170]悠闲的漫步
    [codevs1557]热浪
    [codevs1554]最佳课题选择
    nodejs建站+github page 建站问题总结
  • 原文地址:https://www.cnblogs.com/songafeng/p/129012.html
Copyright © 2011-2022 走看看