简体   繁体   English

使用response.redirect(somepage,true)时无法触发Page_Unload

[英]Page_Unload not firing when using response.redirect(somepage,true)

I'm closing a WCF endpoint in the page_unload of an asp.net page, when using response.redirect() the page_unload event doesn't fire and i'm ending up with ophanned endpoint references. 当使用response.redirect()时,我将在asp.net页面的page_unload中关闭WCF端点,但不会触发page_unload事件,并且最终会出现端点引用错误。

I thought the page_unload should fire everytime. 我认为page_unload应该每次都触发。

Anyone shed any light. 任何人都可以照亮。

Thanks 谢谢

Try this: 尝试这个:

Response.Redirect(somepage, false)

When you pass true instead of false you are indicating that you wish to terminate the execution of the page. 当传递true而不是false时,表示您希望终止页面的执行。 By passing false you are indicating that you wish the page to finish processing before redirecting the client. 通过传递false表示您希望页面在重定向客户端之前完成处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM