如果用户未激活,请返回登录页面. [英] Back to login page if the user is Un active.

查看:80
本文介绍了如果用户未激活,请返回登录页面.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,美好的一天!

我的朋友们如何,

我有一个疑问,无法解决这个问题.

我在ASP.NET,C#,SQL-Server中有一个WEB应用程序.
假设用户登录到该应用程序并且他没有处于活动状态并且没有访问该应用程序.一段时间后,应该返回登录页面.

注意:如果用户为未激活",则应为返回登录页面".再次,用户应输入用户名和密码才能访问.

请帮我解决这个问题.

谢谢.

Hello Good Day !!

How r u my friends,

I have one doubt and am unable to solve this Problem.

I have a WEB APPLICATION in ASP.NET, C#, SQL-Server.
Suppose if the User Logged into that application and he is not active and not accessing that application. after some time it should be back to login page.

Note: if the user is Un Active, it should be Back to Login Page. again the user should enter username and password to access.

Please help me this issue.

Thanks.

推荐答案



据我所知,您可以使用会话验证来做到这一点.如果您正在使用会话验证,则无需担心.只需设置超时限制.此限制表明,如果用户在一段时间内处于非活动状态,则该会话将过期,并且用户必须再次键入userid和密码才能访问该信息.

--AK
Hi,

As per my knowledge you can do it using session validation. If you are using session validation then you don''t need to worry about it. Just set the timeout limit. This limit states that if a user is being inactive for a certain time the session will expire and user will have to key in userid and password again to access the information.

--AK


1.您需要设置会话超时值.
如果用户长时间处于非活动状态,并且在此之后尝试访问,则由于会话已经过期,该用户将被推到主页或注销页面.

但是,这不会使用户在会话超时时自动进入主页.为此:

1.您需要拥有一个通用的站点范围内的javascript文件.
2.每当用户登录时,您都必须启动一个等于会话timout的计时器.
3.在每次回发时重置此计时器.
4.如果用户闲置了这么长时间,则此计时器到期,然后回发到服务器(可能在同一页面上),并希望到此会话必须已经到期时,他才会被推送到homepage.logout页面.[或者您可以选择终止计时器(如果触发此计时器并将其重定向到首页,则由您选择)
1. You need to set the session timeout value.
if the user is inactive for this much time and after that he try to access he will be pushed to home page or logged out page since session has already expired.

BUT, this will not throw the user to home page automatically on session timeout. to do that:

1. you need to have a common site wide javascript file.
2. whenever user logs in you have to start a timer that is equal to session timout.
3. reset this timer on every postback.
4. if the user is idle for this much time then this timer expires then do a postback to the server(perhap on same page) and hopefully by this time the session must have already expired he will be pushed to homepage.logout page.[or you can kill the session if this timer fires and redirect him to home page, your choice]


您好,

当用户闲置更多时间时,实际上没有网站会自动重定向到登录页面.

最好的方法是在web.config中设置会话超时值.默认超时为20分钟.您可以根据需要设置此值.

登录期间,将一些标志或UserID放入会话中.请在Global.asax文件的Application_PreRequestHandlerExecute事件中检查此标志或会话的UserID是否为空.

对于每次命中,都会触发此事件,并且由于检查会话,我们可以确定用户是否处于活动状态.

基于此,您可以重新指向主页.
Hello,

Really no website is redirected to login page automatically when the user idle for more time.

The best possible is set the session Timeout value in web.config.The default timeout is 20 Minutes.You can set this value as per your requirement.

During login,put some flag or UserID into session.Check this flag or UserID of session is null in the Application_PreRequestHandlerExecute event in Global.asax file.

For every hit this event is triggered and also due to checking of session we can identify the the user is active or not.

Based on it you can redirtect to home page.


这篇关于如果用户未激活,请返回登录页面.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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