本文介绍了用户登录时如何显示LOGOUT链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个登录表单,其中注销按钮是可见的,但我想在当前用户登录时显示注销按钮
在网站母版页中我正在使用此
i have a login form where logout button is visble but i want to show logout button when current user is log in
in site master page i am using this
protected void Page_Load(object sender, EventArgs e)
{
//LogoutLink.Visible = Page.User.Identity.IsAuthenticated;
if (Session["Login2"] != null)
{
WELCOME.Text = Session["Login2"].ToString();
}
this is logout button coding
protected void LinkButton1_Click(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();
Response.Redirect("Login.aspx");
}
任何人告诉我plesae
any one tell me plesae
推荐答案
if (Session["Login2"] != null)
{
WELCOME.Text = Session["Login2"].ToString();
LinkButton1.Visible = true;
}
else
LinkButton1.Visible = false;
这篇关于用户登录时如何显示LOGOUT链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!