有y ou曾嘗試爲這兩個網站設置不同的應用程序池?看起來它試圖變得「聰明」,並得出結論,兩個虛擬目錄實際上是同一個網站。
如果一切都失敗了,可以在ASP.NET手動生成的FORM標記中重寫回發URL。使用App_Browsers文件和ControlAdapter可能是最簡單的方法。
我有一個這樣的ControlAdapter實現的例子,儘管它打算使用URL重寫來防止在回發時恢復到實際的幕後URL。但是,我認爲這是可行的您的問題外的開箱
public class FormRewriterControlAdapter : System.Web.UI.Adapters.ControlAdapter
{
protected override void Render(HtmlTextWriter writer)
{
base.Render(new RewriteFormHtmlTextWriter(writer));
}
}
public class RewriteFormHtmlTextWriter : HtmlTextWriter
{
private const string contextItemKey = "FormActionWritten";
public RewriteFormHtmlTextWriter(HtmlTextWriter writer) : base(writer)
{
InnerWriter = writer.InnerWriter;
}
public RewriteFormHtmlTextWriter(System.IO.TextWriter writer) : base(writer)
{
base.InnerWriter = writer;
}
public override void WriteAttribute(string name, string value, bool fEncode)
{
// If the attribute we are writing is the "action" attribute, and we are not on a sub-control,
// then replace the value to write with the raw URL of the request - which ensures that we'll
// preserve the PathInfo value on postback scenarios
if (name == "action" && !HttpContext.Current.Items.Contains(contextItemKey))
{
// Use the Request.RawUrl property to retrieve the un-rewritten URL
value = HttpContext.Current.Request.RawUrl;
HttpContext.Current.Items[contextItemKey] = true;
}
base.WriteAttribute(name, value, fEncode);
}
}
Form.browser文件:
<browsers>
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.HtmlControls.HtmlForm" adapterType="FormRewriterControlAdapter" />
</controlAdapters>
</browser>
</browsers>
嘗試了新的應用程序池...沒有骰子...重寫事情的問題在於,測試版將用作客戶測試的中轉站點......我正在處理40多個包含超過100個類的項目,包括自定義控件...... – Patrick 2009-06-10 15:24:57