st_logonmodule.ascx.cs

来自「本程序是一个宾馆管理系统」· CS 代码 · 共 51 行

CS
51
字号
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;

public partial class ST_LogonModule :ST_ModuleBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                string ST_UserName = HttpContext.Current.User.Identity.Name;
                this.lalInfo.Text = "<b><font color='red'>" + ST_UserName + "</font></b>,使用本系统!";
                this.lalInfo.Style["color"] = "Green";
            }
            else
            {
                this.lalInfo.Text = "你还没有登陆,登陆后可使用各项服务";
                this.lalInfo.Style["color"] = "Red";
            }
        }
      
    }
    protected void btbLogon_Click(object sender, EventArgs e)
    {
       if (Authenticate(this.txtUserName.Text.ToString(), this.txtUserPwd.Text.ToString()) == true)
      {


           FormsAuthentication.SetAuthCookie(this.txtUserName.Text.ToString(),false);
           //FormsAuthentication.RedirectFromLoginPage(this.txtUserName.Text.ToString(), false);

            //this.Label1.Text = "asdfasdfasdfasdfffffffffffffff";
            //Response.Redirect(PathPrefix + "/ST_RCategoryMan.aspx");
            Response.Redirect("ST_RCategoryMan.aspx");
        }
        else
      {
          this.lalInfo.Text = "用户名或密码错误";
       }
    }
}

⌨️ 快捷键说明

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