?? userlogin.aspx.cs
字號:
?using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using lalablog;
public partial class user_userLogin : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
tb_username.Focus();
}
protected void btnLogin_Click(object sender, EventArgs e)
{
string username = Server.HtmlEncode(tb_username.Text.ToString());
string password = Server.HtmlEncode(tb_password.Text.ToString());
if (username.Length > 0 && password.Length > 0)
{
password = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1");
string loginip = Request.UserHostAddress;
bloguser user1 = new bloguser(username, password, loginip);
string x = user1.login();
/*如果返回信息是success,可以正常登陸*/
if (x == "success")
{
Session["userid"] = user1.getuserid();
Session["username"] = user1.getNickName();
if (Request.QueryString["url"] != null)
{
string url = Request.QueryString["url"];
Response.Redirect(url);
}
else
Response.Redirect("index.aspx");
}
else
{
myfunc m1 = new myfunc(x);
Response.Write(m1.JavaMsg());
}
}
/*用戶名或者密碼的長度小于1*/
else
{
myfunc m1 = new myfunc("用戶名還是密碼忘輸了吧");
Response.Write(m1.JavaMsg());
}
}
protected void btn_forget_pass_Click(object sender, EventArgs e)
{
Response.Write("<script type=text/javascript>");
Response.Write("window.opener.location.href='userfindpass.aspx';");
Response.Write("window.close();");
Response.Write("</script>");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -