JavaScript history 物件詳解
LOgin
using AiShow.BLL;
using AiShow.Common;
using AiShow.IBLL;
using AiShow.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace AiShow.WebSite
{
public partial class Login : System.Web.UI.Page
{
IAccountManager IAccountManager = new AccountManager();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnLogin_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
// 登入驗證
string userName = txtUserName.Text;
string password = txtPassword.Text;
IAccountManager userManager = new AccountManager();
OperResult<TBUsers> operResult = userManager.LoginByUserName(userName, password);
if (operResult.StatusCode==Common.StatusCode.Succeed)
{
}
else
{
Response.Redirect("Default.aspx");
}
}
else
{
ClientScript.RegisterStartupScript(GetType(), "loginerror", $"alert('{operResult.Message}')", true);
}
}
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="AiShow.WebSite.Login" %>
<asp:Content ID="HeadContent" ContentPlaceHolderID="HeadContent" runat="server">
<style>
.login-screen-content { position: relative; }
.space { width: 100%; height: 200px; }
.image { width: 100%; height: 270px; background: url("/imgs/account-bg.jpg") #007aff; background-position-x: center; background-position-y: top; background-repeat: no-repeat; position: absolute; z-index: -10; top: 0; }
.login-box { width: 80%; margin: 0 auto; background-color: #ffffff; border-radius: 10px; overflow: hidden; box-shadow: rgba(0,0,0,0.6) 3px 5px 10px; }
</style>
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyContent" runat="server">
<div class="page no-navbar no-toolbar no-swipeback" data-page="login-username">
<div class="page-content login-screen-content">
<div class="image"></div>
<div class="space"></div>
<div class="login-box">
<div class="block">
<p class="segmented segmented-raised">
<a class="button button-active">使用者名稱密碼登入</a>
<a class="button external" href="Mobile.aspx?ReturnUrl=<% = Request.QueryString["ReturnUrl"] %>">手機號密碼登入</a>
</p>
</div>
<div class="list">
<ul>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-title item-label">使用者名稱</div>
<div class="item-input">
<asp:TextBox ID="txtUserName" MaxLength="16" TextMode="SingleLine" runat="server" PlaceHolder="請輸入使用者名稱"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvUserName" runat="server" ErrorMessage="使用者名稱不能為空" ControlToValidate="txtUserName" Display="None"></asp:RequiredFieldValidator>
</div>
</div>
</li>
<li class="item-content item-input">
<div class="item-inner">
<div class="item-title item-label">密碼</div>
<div class="item-input">
<asp:TextBox ID="txtPassword" MaxLength="32" TextMode="Password" runat="server" PlaceHolder="請輸入密碼"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvPassword" runat="server" ErrorMessage="密碼不能為空" ControlToValidate="txtPassword" Display="None"></asp:RequiredFieldValidator>
</div>
</div>
</li>
</ul>
</div>
<div class="block">
<div class="list">
<ul>
<li>
<asp:ValidationSummary ID="vsLogin" runat="server" ShowMessageBox="True" ShowSummary="False" />
<asp:Button ID="btnLogin" runat="server" Text="立即登入" CssClass="button button-fill button-large button-round" OnClick="btnLogin_Click" />
</li>
</ul>
<div class="block-footer">
<p>登入即代表您同意《使用者服務協議》</p>
<p>沒有賬號?<a href="Register.aspx" class="close-login-screen external">現在註冊</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
</asp:Content>
<asp:Content ID="ScriptContent" ContentPlaceHolderID="ScriptContent" runat="server">
</asp:Content>