.NET C#:如何将一个AJAX调用过程中处理表单认证过期表单、如何将、过程中、NET

由网友(开着空调盖被子)分享简介:有关背景下,我在我的web.config中设置窗体身份验证超时值,和正在使用ASP.NET MVC 1。我想这可能是最简单的说明我的问题,因为2用例 - 第一个会发生什么没有认证超时,而第二个有认证超时会发生什么:For context, I have a forms authentication timeout v...

有关背景下,我在我的web.config中设置窗体身份验证超时值,和正在使用ASP.NET MVC 1。我想这可能是最简单的说明我的问题,因为2用例 - 第一个会发生什么没有认证超时,而第二个有认证超时会发生什么:

For context, I have a forms authentication timeout value set in my web.config, and am using ASP.NET MVC 1. I think it might be easiest to state my problem as 2 use cases -- the first one what happens without an authentication timeout, and the second one what happens with an authentication timeout:

正常情况下:

用户登录到应用程序,并验证计时器开始滴答作响。虽然认证期限仍然有效,用户点击的东西,触发AJAX调用(通过jQuery的),在页面上。我们打​​的服务器,处理请求,并返回一个局部视图给​​用户(为的ActionResult )。该HTML来通过作为一个字符串到阿贾克斯的成功的方法,我拿这个网站并注入到页面上的DIV。这是所有预期。

The user logs into the app, and the authentication timer starts ticking. While the authentication period is still valid, the user clicks something on the page that triggers an AJAX call (through jQuery). We hit the server, process the request, and return a partial view to the user (as an ActionResult). The html comes through as a string to the ajax's success method, and I take this html and inject it into a div on the page. This is all expected.

超时情况:

用户登录到应用程序,并验证计时器开始滴答作响。之后的 X 的时间量,认证期限届满。随着到期时间后,用户点击的东西,触发AJAX调用(使用jQuery)在页面上。我们击中了服务器,但身份验证票证已过期。 .NET会自动重定向到该设置超时时间相同的web.config元素定义的 loginURL 值。对我来说,这个页面是登录页面,用户被要求输入用户名。因此,

阅读全文

相关推荐

最新文章