我怎么知道登录与否 [英] how can i know login or not

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

问题描述

大家好
我创建了包含登录名和身份验证的网站,并且我想确定是否有人输入要重定向到登录页面的网址,并且当他成功登录后转到他输入了
的网址
我使用会话来了解某个登录名是否有效,但我希望获得最佳实践

Hi every one
I create web site contain login and authentication and I want to if someone type the url to redirected to login page and when he login successfully go the url he has typed

i use session to know if some one login or and it work but i ask for best practice

推荐答案

为了检查是否有人登录,请使用会话.为了重定向到请求的页面,您可以使用查询字符串.
In order to check if someone has logged in or not, use session. In order to redirect to the page which was requested for, you can use query string.


您可以在webconfig文件中使用以下内容

You can use the following in your webconfig file

<authentication mode="Forms">
    <forms name="AName" loginUrl="LoginPage.aspx" protection="All" timeout="20"/>
</authentication>



成功登录后,在登录页面中使用FormsAuthentication.RedirectFromLoginPage(username, False).



and in your login page use FormsAuthentication.RedirectFromLoginPage(username, False) once the login has been successfully carried out.


这篇关于我怎么知道登录与否的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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