如何在验证后更改菜单任务栏。我目前有一个链接框和一个标签
protected void Page_Load(object sender, EventArgs e)
{
// check if user is logged in
if (Session["login"] != null)
{
LblLogin.Text = "Welcome " + Session["Login"].ToString();
LblLogin.Visible = true;
LinkButton1.Text = "Logout";
}
else
{
LblLogin.Visible = false;
LinkButton1.Text = "Login";
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
//user logs in
if (LinkButton1.Text == "Login")
{
Response.Redirect("Manage_Register.aspx?Scr=");
}
else
{
//User logs out
Session.Clear();
Response.Redirect("Default.aspx?Scr=");
}
然而我现在想要它在菜单栏上,我有home, about, contact, login
当用户成功登录时,我希望登录文本更改为注销。