Login.aspx.cs
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:2k
- 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 System.Data.SqlClient;
- public partial class AdminManager_Login : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(CookieInclude.CookieId))
- {
- Response.Redirect("Index.aspx");
- }
- }
- protected void TxtUserName_ServerChange(object sender, EventArgs e)
- {
-
- }
- protected void TxtPassword_ServerChange(object sender, EventArgs e)
- {
- }
- protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
- {
- SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DB"].ConnectionString);
- int matchi = WoYingCommon.LoginSet(this.TextBox_UserId.Value, this.TextBox_Password.Value, "Users", "UserId", "Password", conn, new SqlParameter("@UserId", SqlDbType.VarChar, 40));
- if (matchi == 0)
- {
- MessageBox.Show("无此用户");
- }
- if (matchi == 1)
- {
- MessageBox.Show("密码错误");
- }
- if (matchi == 2)
- {
- Model.Users MU = new BLL.Users().GetPageList(1, 1, "ID", false, "UserId='" + this.TextBox_UserId.Value + "' and Password='" + this.TextBox_Password.Value + "'")[0];
- SessionInclude.Id = MU.Id.ToString();
- SessionInclude.SessionId = this.TextBox_UserId.Value;
- if (DropDownList1.SelectedIndex == 0)
- {
- CookieInclude.CookieId = this.TextBox_UserId.Value;
- CookieInclude.Id = MU.Id.ToString();
- }
- Response.Redirect("index.aspx");
- }
-
- }
-
- }