st_logonmodule.ascx.cs

来自「酒店管理系统,适合做毕业设计的人」· CS 代码 · 共 69 行

CS
69
字号
namespace ST_GROUP.Modules
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Web.Security;

	/// <summary>
	///		ST_LogonModule 的摘要说明。
	/// </summary>
	public partial class ST_LogonModule : ST_ModuleBase
	{

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(HttpContext.Current.User.Identity.IsAuthenticated)
			{
				String ST_UserName=HttpContext.Current.User.Identity.Name;
				ShowMsg.Text="<b><font color='red'>"+ST_UserName+"</font></b>,欢迎您使用本系统!";
				ShowMsg.Style["color"]="Green";
			}
			else{
				ShowMsg.Text="您还未登录本系统,登录后才可使用各项服务";
				ShowMsg.Style["color"]="Red";
			}
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.LoginButton.Click += new System.EventHandler(this.LogonButton_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void LogonButton_Click(object sender, System.EventArgs e)
		{
			if(Authenticate(LogonNameTextBox.Text.Trim() ,LogonPasswordTextBox.Text.Trim())==true)
			{
                FormsAuthentication.SetAuthCookie(LogonNameTextBox.Text.Trim(),true);
               
				Response.Redirect(PathPrefix+"/ST_default.aspx");
          
			}
			else
			{  
                MismatchLabel.Visible=true;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?