[英]ASP.NET - Handle redirect after async post back
I have an ASP.NET web application that uses Update Panels. 我有一个使用更新面板的ASP.NET Web应用程序。 The web application is integrated in a SiteMinder SSO environment.
该Web应用程序集成在SiteMinder SSO环境中。
The problem occurs when Siteminder thinks it is time to re-authenticate the user. 当Siteminder认为是时候重新验证用户身份时,就会出现此问题。 When the user performs an action that results in an async postback, Siteminder catches this request and sends back a redirect response to its login page.
当用户执行导致异步回发的操作时,Siteminder会捕获此请求,并将重定向响应发送回其登录页面。
My ASP.NET page does not expect this and throws an PageRequestManagerParserErrorException. 我的ASP.NET页不希望这样,并引发PageRequestManagerParserErrorException。
My guess is that I have to catch this redirect response in client code (using a PageRequestManager event?) and handle the redirect correctly. 我的猜测是,我必须在客户端代码中捕获此重定向响应(使用PageRequestManager事件?)并正确处理重定向。
But how? 但是如何?
I have the same problem. 我也有同样的问题。 I found one solution here: http://forums.asp.net/t/1470176.aspx/1
我在这里找到了一种解决方案: http : //forums.asp.net/t/1470176.aspx/1
I ended up with the following javascript on each page: 我最后在每个页面上使用以下javascript:
function pageLoad() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
}
function EndRequestHandler(sender, args) {
if (args.get_error() != undefined) {
if (args.get_response().get_responseData().indexOf("<HTML><HEAD><TITLE>") == 0) {
args.set_errorHandled(true);
__doPostBack("", "");
}
else {
// not my error so let the default behavior happen
}
}
}
It stops the page from beaking completely but it does do a full page refresh instead of an async postback once SSO has timed out on the client. 它可以阻止页面完全停止,但是一旦客户端上的SSO超时,它就会刷新整个页面,而不是异步回发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.