登录后出现问题 [英] Problem in after Login

查看:86
本文介绍了登录后出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我登录到登录页面时,该页面将重定向到主页,但是当我按BackSpace按钮将其重定向到登录页面.我的要求是该页面不应重新登录到登录页面

When i''m login to the login page the page will redirect to the Main page but When i''m pressing BackSpace button it will redirect to the login page My requirement is the page should not redrict to the login page

推荐答案

本文 [^ ]描述了一种通过JavaScript进行此操作的方法.但是,您需要当心,这可能无法在其他浏览器上使用.

按照标准功能,我建议您让后退浏览器按钮按原样工作,但要管理会话,以防万一用户仍在登录,则不必再次登录.

要查看登录屏幕,用户需要注销或会话应超时.
This article[^] describes an approach to do this via Javascript. However, you need to watch out for the fact that this might not work on other browsers.

As per standard functionality, I would recommend you let the back browser button work as is, but manage sessions so that incase the user is still logged in, he need not log in again.

To see the login screen, the user needs to logout or the session should time out.


您可以使用服务器端解决方案或客户端(javascript解决方案)

服务器端

登录后使用此代码

You can use either server side solution or client side (javascript solution)

Server side

After logging in use this code

Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetAllowResponseInBrowserHistory(False)


客户端

在每页的开头部分添加以下文本.


client side

include the following text in the head portion of each page.

</script>
        history.forward();
</script>


如果使用浏览器后退按钮,则可以参考此技巧以了解如何使用它: ^ ]

如果是退格按钮,则需要处理页面中的退格键事件代码.放置一个处理按键事件的Javascript,可以取消按键的默认行为,以使页面保持原样而不是退格.然后,该方法将具有无法编辑页面上文本的缺点-如果需要,您必须为该控件重新调用退格事件.
If browser back button then you can refer this tip to get an idea on how to handle it: Browser back button issue after logout[^]

If it''s the backspace button, then you need to handle the backspace keyevent code in your page. Put a Javascript handling the key event and may be cancel the key defaultbehaviour to keep the page as is and not backspace. Then this method will have a downside of not able to edit text on the page - if needed, you have to reinvoke backspace event for that control.


这篇关于登录后出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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