在关闭自动登录的用户了asp.net网站 [英] automatically logging users out of asp.net website on close

查看:157
本文介绍了在关闭自动登录的用户了asp.net网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我继承了由多个的.aspx和的.ascx页,并成为相当新的网络开发和especailly asp.net一个asp.net网站。我在网站创建在登录一个cookie,如果页面超时的他们,而他们正在进入信息自动登录用户回。

I recently inherited an asp.net website made up of multiple .aspx and .ascx pages and being rather new to web development and especailly asp.net. I have the site create a cookie upon login to automatically log users back in if the page times out on them while they're entering information.

我需要的网站时,该网站已关闭自动注销用户。显然,使用每个页面上的me.close事件将不会工作,因为我们不希望它每次他们浏览到一个新的一页网站时登录的人了。

I need the site to automatically log users out when the site is closed. Obviously using the me.close event on each page won't work because we don't want it to log people out every time they navigate to a new page in the site.

我试过设置在IIS都和网站的文件超时来反而显得更长它不产生作用。

I've tried setting the timeouts in both IIS and in the files of the website to longer but it doesn't seem to have an effect.

有没有一种简单的方法,当他们离开现场,但不是当他们从网页浏览网页时自动注销用户。

Is there an easy way to automatically log users out when they leave the site but not when they navigate from page to page.

推荐答案

HTTP是一个无状态的协议,所以真的是没有简单的方法来做到这一点。

HTTP is a stateless protocol, so there really is no easy way to do this.

如果这将是您的服务的重要组成部分,你可以使用AJAX坪,每30秒钟,然后如果没有2分钟一个ping就可以登录他们出去。

If it's going to be an essential part of your service, you can use AJAX pings every 30 seconds, then if there isn't a ping for 2 minutes you can log them out.

这是我已经在我的网站的应用程序之一完成的,它似乎工作得很好。

This is what I've done on one of my sites apps and it seems to work quite well.

这篇关于在关闭自动登录的用户了asp.net网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆