傳送 HTTP 標頭後無法重新導向

摘要:傳送 HTTP 標頭後無法重新導向

response.redirect("mpGetSignPage.aspx?mpID=" + mpID + "&msg=" + Msg)

error

改用

Server.Transfer("mpGetSignPage.aspx?mpID=" + id + "&msg=" + w.msg)

or

  Public Sub goUrl(ByVal url As String)
    ' Cleans the message to allow single quotation marks
    Dim script As String = "<script type=""text/javascript"">" & _
"window.location.href='" + url + "';" & _
"</script>"
    ' Gets the executing web page
    Dim page As Page = TryCast(HttpContext.Current.CurrentHandler, Page)

    ' Checks if the handler is a Page and that the script isn't allready on the Page
    If page IsNot Nothing AndAlso Not page.ClientScript.IsClientScriptBlockRegistered("alert") Then
      page.ClientScript.RegisterClientScriptBlock(GetType(Alert), "sel", script)
    End If
  End Sub