Exemple #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
            *
            * Custom HtmlTextWriter to fix Form Action
            * Based on Jesse Ezell's "Fixing Microsoft's Bugs: URL Rewriting"
            * http://weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx
            *
            * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
            // this removes the action attribute from the form
            // so that it posts back correctly when using url re-writing

            string action = Path.GetFileName(Request.RawUrl);

            if (action.IndexOf("?") == -1 && Request.QueryString.Count > 0)
            {
                action += "?" + Request.QueryString.ToString();
            }
            if (writer.GetType() == typeof(HtmlTextWriter))
            {
                writer = new MojoHtmlTextWriter(writer, action);
            }
            else if (writer.GetType() == typeof(Html32TextWriter))
            {
                writer = new MojoHtml32TextWriter(writer, action);
            }

            base.Render(writer);
        }
Exemple #2
0
        protected override void Render(HtmlTextWriter writer)
        {
            /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
            *
            * Custom HtmlTextWriter to fix Form Action
            * Based on Jesse Ezell's "Fixing Microsoft's Bugs: URL Rewriting"
            * http://weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx
            *
            * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
            // this removes the action attribute from the form
            // so that it posts back correctly when using url re-writing

            string action = Path.GetFileName(Request.RawUrl);
            if (action.IndexOf("?") == -1 && Request.QueryString.Count > 0)
            {
                action += "?" + Request.QueryString.ToString();
            }
            if (writer.GetType() == typeof(HtmlTextWriter))
            {
                writer = new MojoHtmlTextWriter(writer, action);
            }
            else if (writer.GetType() == typeof(Html32TextWriter))
            {
                writer = new MojoHtml32TextWriter(writer, action);
            }

            base.Render(writer);
        }