📄 login.aspx.cs
字号:
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;
namespace _lib.CMS
{
/// <summary>
/// login 的摘要说明。
/// </summary>
/// download from www.51aspx.com(51aspx.com)
public class login : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator3;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.TextBox TextBox2;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected System.Web.UI.HtmlControls.HtmlInputHidden txtID;
protected System.Web.UI.WebControls.RequiredFieldValidator Requiredfieldvalidator4;
private void Page_Load(object sender, System.EventArgs e)
{
if (this.Request.QueryString["logout"]=="true")
{
// 退出登录状态
Session.Clear();
Response.Redirect("../");
Response.End();
}
TCmsUser oUser = new TCmsUser(this);
if (!IsPostBack)
{
if (oUser.isNull)
{
Label3.Text = "请登录:";
}
else
{
Label3.Text = "<font color=red>您无权访问该功能,请重新登录。</font>";
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
bool isValid = TCmsUser.CheckLogin(TextBox1.Text,TextBox2.Text,this);
Uri url;
//string domain;
if (this.ViewState["dUrl"]==null)
{
url = Request.UrlReferrer;
this.ViewState["dUrl"] = url;
}
else
{
url = (Uri)this.ViewState["dUrl"];
}
if (isValid)
{
Response.Redirect(url.ToString());
Response.End();
}
else
{
Label3.Text = "<font color=red>用户名或密码错误,登录失败。</font>";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -