私はそれを持っている!奇妙な外国語のブログをありがとう Og :)
これを修正するには、ASP.NET AJAX クライアント側フレームワークに、部分的な要求を Server.Transfer() 呼び出しの実際のターゲットに直接向けるよう指示するだけです。私は起こりうる副作用を非常に恐れています (これが何をスキップするかは誰にもわかりません - インフラストラクチャには目的があります) が、これまでのところうまく機能しているようです.
これは、私のページの Load イベントで呼び出される問題を修正するメソッドです。
///
/// Adds to the page a JavaScript that corrects the misbehavior of AJAX when a page is target of a Server.Transfer call.
///
protected void AjaxUrlBugCorrection()
{
string actualFile = Server.MapPath(AppRelativeVirtualPath);
string redirectFile = Server.MapPath(Context.Request.FilePath);
string baseSiteVirtualPath = HttpRuntime.AppDomainAppVirtualPath;
if (actualFile != redirectFile)
{
System.Text.StringBuilder sbJS = new System.Text.StringBuilder();
string actionUrl = string.Format("'{0}'", baseSiteVirtualPath + AppRelativeVirtualPath.Replace("~", String.Empty));
sbJS.Append("Sys.Application.add_load(function(){");
sbJS.Append(" var form = Sys.WebForms.PageRequestManager.getInstance()._form;");
sbJS.Append(" form._initialAction = " + actionUrl + ";");
sbJS.Append(" form.action = " + actionUrl + ";");
sbJS.Append("});");
ClientScript.RegisterStartupScript(this.GetType(), "CorrecaoAjax", sbJS.ToString(), true);
}
}