chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace Education.MobileSurvey
|
||||
{
|
||||
public partial class Login : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
lbSystemName.Text = PublicVariable.SystemName + " - 行動版";
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
if (Session[PublicVariable.UserId] != null && !string.IsNullOrEmpty(Session[PublicVariable.UserId].ToString()))
|
||||
{
|
||||
Response.Redirect("SurveyList.aspx");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void btnLogin_Click(object sender, EventArgs e)
|
||||
{
|
||||
lbErrMsg.Text = "";
|
||||
|
||||
if (string.IsNullOrEmpty(txtUserId.Text))
|
||||
{
|
||||
lbErrMsg.Text = "請輸入使用者代號!";
|
||||
return;
|
||||
}
|
||||
|
||||
LoginBPSN login = new LoginBPSN();
|
||||
login.UserId = txtUserId.Text;
|
||||
login.Password = txtPassword.Text;
|
||||
if (login.GetResult())
|
||||
{
|
||||
Session[PublicVariable.UserId] = txtUserId.Text;
|
||||
Session[PublicVariable.UserName] = login.UserName;
|
||||
Session[PublicVariable.IsManager] = false;
|
||||
Session[PublicVariable.IsWorker] = false;
|
||||
Session[PublicVariable.IsBackend] = false;
|
||||
|
||||
FormsAuthentication.SetAuthCookie(txtUserId.Text, false);
|
||||
Response.Redirect("SurveyList.aspx");
|
||||
}
|
||||
else
|
||||
{
|
||||
lbErrMsg.Text = login.ErrorMessage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user