Asp.net Response.Redirect

时间:2014-03-18 07:38:52

标签: asp.net response.redirect

我的项目的起始页面是Default.aspx。

    protected void ImageButton1_Click1(object sender, ImageClickEventArgs e)
    {

         Response.Redirect("Payment.aspx);

    }

当我点击按钮时,它返回//localhost/Default.aspx/Payment.aspx而不是//localhost/Payment.aspx。问题在哪里?

2 个答案:

答案 0 :(得分:3)

Response.Redirect("~/Payment.aspx");

答案 1 :(得分:1)

试试这个。

Response.Redirect("~/Payment.aspx");
  

波形符(〜)字符表示ASP.NET中应用程序的根目录。