Web应用程序在asp.net中的登录问题 [英] login problem in web applic in asp.net

查看:85
本文介绍了Web应用程序在asp.net中的登录问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hiiiiii ..

我正在浏览Web应用程序...有导航表单.我导航到第二页,然后按回浏览器的btn,我将重定向到登录页面..
nw wen我按了d浏览器的d forwrd btn,我没有b导航到d第二页,而是我需要2个显示登录页面本身..



因此,该怎么做.......plz:confused:

hiiiiii..

m working on web appln....hav login form..wen i navigate to 2nd page and press back btn of browser i''ll get redirected to login page..
nw wen i press d forwrd btn of d browser i shud not b navigated to d 2nd page instead i need 2 show login page itself..



so how to do this.......plz:confused:

推荐答案

通常,浏览器的后退和前进按钮使用缓存副本.因此,在前进和后退时,不会重新运行服务器代码.因此,如果登录后返回登录页面,将很难显示登录页面.

另一种选择是不允许页面被缓存.这将禁用/显示浏览器的后退按钮.因此,用户将不能后退/前进.

在这里您可以使用:
通过使响应过期,可以轻松完成此操作. ASP.NET 2.0中的代码:
Generally, browser back and forward buttons use the cache copy. So while going forward and coming back no server code is re-run. Thus it would be difficult for you to show login page if one comes back after logging in.

Alternative would be to not allow pages to be cached. This would disable/gray out the back forward button of browser. Thus, user wont be able to do back/forward.

Here you can use:
This can be easily done by expiring the Response. The code for this in ASP.NET 2.0:
// Code disables caching by browser. Hence the back browser button
// grayed out and could not causes the Page_Load event to fire 
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();


这篇关于Web应用程序在asp.net中的登录问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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