簡體   English   中英

在不使用response.end,ASP的情況下重定向到另一個頁面后結束代碼執行

[英]end code execution after redirecting to another page without using response.end, ASP

我想重定向到另一個頁面,然后停止執行其余代碼,而無需使用response.end,因為它引發了end示例的異常:

    HttpContext.Current.Response.Redirect(url, false);
    HttpContext.Current.ApplicationInstance.CompleteRequest();
    //here I want to stop code execution but without using return as well as this code will be placed in a method
Server.Transfer("url", true);

這是重定向URL的另一種方法,希望它可以為您提供幫助
PS:這是服務器端代碼

每個Response.Redirect()方法; 最后一個參數是bool endResponse ,它指出: 指示是否應終止當前頁面的執行。 因此將其更改為

Response.Redirect(url, true);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM