First of all, I would like to thank Lao Zhao for writing an article, http://www.cnblogs.com/JeffreyZhao/archive/2006/12/27/604373.aspx#post
In fact, this problem is not a MS Ajax error at all, it is completely the reason why we did not use URLRewrite.
Lao Zhao's solution is to rewrite a Form class and clear the original Form Action.
I don't know if I can work normally, but I think it is very dangerous to use the default attribute to clear it .~~~
Rewriting the Form class makes reference a little troublesome. I think it is more convenient to rewrite a Page. My practice in www.365rss.cn is as follows:
Using System;
Using System. IO;
Using System. Web;
Using System. Web. UI;
Namespace okpower. Utility
{
/** // <Summary>
/// URLRewrite Page Base Class
/// By Kai. Ma http://kaima.cnblogs.com
/// </Summary>
Public class URLRewritePage: Page
{
Public URLRewritePage ()
{
}
Protected override void Render (HtmlTextWriter writer)
{
Writer = new FormFixerHtmlTextWriter (writer. InnerWriter );
Base. Render (writer );
}
}
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 encode)
{
// If the current output attribute is the form-marked action attribute, replace the value with the rewritten false URL
If (_ url! = Null & string. Compare (name, "action", true) = 0)
{
Value = _ url;
}
Base. WriteAttribute (name, value, encode );
}
}
}
You can inherit this URLRewritePage in the future, or even set it in web. config, once and for all.
Welcome