?? st_login.aspx.cs.bak
字號(hào):
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Security;
namespace STGROUP.ST_WebBook
{
/// <summary>
/// WebForm1 的摘要說(shuō)明。
/// </summary>
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, System.EventArgs e)
{
// 在此處放置用戶代碼以初始化頁(yè)面
}
#region Web 窗體設(shè)計(jì)器生成的代碼
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設(shè)計(jì)器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
}
#endregion
protected void btnOK_Click(object sender, System.EventArgs e)
{
//判斷用戶是否登錄成功,如果成功,轉(zhuǎn)到ST_Main.aspx,如果失敗,提示失敗
STGROUP.ST_BookBiz.ST_Auth st_auth = new STGROUP.ST_BookBiz.ST_Auth();
int userid=0;
if(st_auth.ST_Login(txtName.Text, txtPass.Text, out userid))
{
string[] role = st_auth.ST_LoginType(txtName.Text);
ST_BookBiz.ST_Identity identity = new ST_BookBiz.ST_Identity(txtName.Text.Trim(), userid);
Context.User = new ST_BookBiz.ST_Principal(identity,role);
identity.Name = txtName.Text;
identity.Roles = role[0];
identity.Save();
FormsAuthentication.SetAuthCookie(txtName.Text, false);
Response.Redirect("ST_Common/ST_Main.aspx");
}
else
{
Response.Write("<script language='javascript'>alert('登陸失??!');</script>");
}
}
protected void btnReg_Click(object sender, System.EventArgs e)
{
Response.Redirect("ST_User/ST_UserAdd.aspx?Action=add");
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -