从我的 asp.net 页面,我正在使用 System.Web.HttpContext.Current.Response.Write 生成一个页面。完成后,我想重定向到另一个页面。它不起作用。如果我最后有 Response.Redirect,那么它会立即重定向而不产生页面。部分代码如下所示:
string targetUrl = ConfigurationManager.AppSettings["URL"].ToString();
System.Web.HttpContext.Current.Response.Write(
"<form name='newForm' target='_blank' method=post action=" + targetUrl + " >");
System.Web.HttpContext.Current.Response.Write(
string.Format("<input type=text name=\"txtAcctNumber\" value=\"{0}\">",
ViewState["GroupNumber"].ToString()));
System.Web.HttpContext.Current.Response.Write(
string.Format("<input type=text name=\"txtAmountDue\" value=\"{0}\">", txtAmountDue.Text));
System.Web.HttpContext.Current.Response.Write("</form>");
System.Web.HttpContext.Current.Response.Write("</body>");
Response.Write("<SCRIPT LANGUAGE='JavaScript'>document.forms[0].submit();</SCRIPT>");
Response.Clear();
Response.Redirect("~/PremiumPayment/InvoiceSearch.aspx");
谢谢