我创建了一个登录页面,但是当用户登录时,我想将登录按钮更改为注销。我在我的 Site.Master 中创建了登录按钮。谁能告诉我该怎么做......
<div id="header">
<div id="header_in">
<div id="menu">
<ul>
<li><a href="Home.aspx">Home</a></li>
<li><a href="about.aspx">About</a></li>
<li><a href="ourwork.aspx">Our Works</a></li>
<li><a href="login.aspx">Login / Register</a></li>
</ul>
以下代码用于登录
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
con.Open();
cmd = new SqlCommand("SELECT * FROM WhatTypes where UserName = '" + txtUN.Text + "' AND Password ='" + txtP.Text + "'", con);
dr = cmd.ExecuteReader();
if (dr.Read())
{
//ID = dr["ID"].ToString();
Session["user"] = dr["UserLevel"];
// Session["FirstName"] = dr["First Name"];
if (Session["user"].ToString() == "A")
{
Response.Redirect("AdminPanel.aspx");
}
else if (Session["user"].ToString() == "M")
{
Response.Redirect("Activity.aspx");
}
else
Response.Redirect("Home.aspx");
}
else
{
lblinvalidlogin.Visible = true;
lblinvalidlogin.Text = "Invalid username or password.";
}
}