简体   繁体   English

如果用户已经登录,如何在登录链接上自动重定向点击管理页面

[英]how to auto redirect on login link click to admin page if user already logged in

How to do this ... 这个怎么做 ...

i have a login page link above the page /// i want if user already loggedin then anybody click on loginlink then the user will automatically redirect to default.aspx .. 我在页面上方有一个登录页面链接///我想如果用户已经登录,那么任何人都单击loginlink,那么用户将自动重定向到default.aspx。

how to do this using vb.net ? 如何使用vb.net做到这一点?

If user login then mentioned the session like this: 如果用户登录,则提到会话是这样的:

if(login==true)
{
    sesssion["UID"]=txtUserID.Text.ToString();
} 

Then, after user click on the login link then check: 然后,在用户单击登录链接之后,然后检查:

if(session["UID"]!=null)
{
    response.redirect("default.aspx");
}
else
{
    response.redirect("LoginPage.aspx");
}

尝试

Page.User.Identity.IsAuthenticated ==true

You have two built-in options when using Membership / Forms Authentication: 使用“成员资格/表单身份验证”时,有两个内置选项:

1: Use LoginStatus control instead of external link. 1:使用LoginStatus控件代替外部链接。 It will automatically change to Logout when user is logged-in. 用户登录后,它将自动更改为注销。

Or 要么

2: Use LoginView to display your login and Logout links. 2:使用LoginView显示您的登录和注销链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM