【发布时间】:2011-12-26 02:11:17
【问题描述】:
我在 UpdatePanel 中有一个按钮,如果单击该按钮,在某些情况下会将用户重定向到同一文件夹中的另一个页面,否则将使用一些信息更新 UpdatePanel。如果我以这种方式进行重定向:
Response.Redirect("Test.aspx");
它会重定向到 /Test.aspx,这在大多数情况下会很好,但问题是应用程序是通过反向代理(在 x.com/y/)访问的,这将导致一些问题,因为 /Test .aspx 会将用户重定向到执行代理的服务器根目录中不存在的文件。
是否可以强制重定向跳过 / 内容,因为在这种情况下没有必要,因为两个文件都在同一个文件夹中。
编辑:代码示例
<asp:ScriptManager ID="script" runat="server" />
<asp:UpdateProgress ID="prog" runat="server" AssociatedUpdatePanelID="up">
<ProgressTemplate>
<h1>Waiting...</h1>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:TextBox ID="txt" runat="server" />
<asp:Button ID="btn" runat="server" OnClick="click" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
点击方法:
protected void click(object sender, EventArgs e)
{
Thread.Sleep(3000);
if (txt.Text == "redirect")
Response.Redirect("Test.aspx");
else
txt.Text = "";
}
【问题讨论】:
-
你的问题不够清楚,能不能再详细一点?
标签: asp.net ajax asp.net-ajax