[英]How do I make it so the user can log out of the website?
在我的網站上,用戶可以選擇注冊然后登錄,但是我想知道我該怎么做,以便用戶以后可以注銷。
c#代碼:這是登錄代碼。
protected void Page_Load(object sender, EventArgs e)
{
lb_Fail.Visible = false;
}
protected void btn_Login_Click(object sender, EventArgs e)
{
// connecion to the database
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Fasthosts_MMConnectionString"].ConnectionString);
SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) FROM Fasthosts_Registration_MM WHERE username='" + tb_UsernameLogin.Text + "' AND password='" + tb_PasswordLogin.Text + "'", conn);
/* in above line the program is selecting the whole data from table and the matching it with the user name and password provided by user. */
DataTable dt = new DataTable(); //this is creating a virtual table
sda.Fill(dt);
if (dt.Rows[0][0].ToString() == "1")
{
Response.Redirect("Domains.aspx");
}
else
{
lb_Fail.Text = ("Incorrect login details");
lb_Fail.Visible = true;
}
}
如果創建一個注銷按鈕,我需要什么代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.