同一页面切换页面

同一页面切换页面

 

 

 

登录页面

<a class="button button-active">用户名密码登录</a>
<a class="button external" href="Mobile.aspx?ReturnUrl=<% = Request.QueryString["ReturnUrl"]

%>">手机号密码登录</a>

后台

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)
{
var user = operResult.ReadResult();
IdentityManager.SaveUser(user);
var url = Request.QueryString["ReturnUrl"];
if (!string.IsNullOrWhiteSpace(url))
{
Response.Redirect(url);
}
else
{
Response.Redirect("Personal.aspx");
}
}
else
{
ClientScript.RegisterStartupScript(GetType(), "loginerror", $"alert('{operResult.Message}')", true);
}
}
}
}

手机号码登录

<a class="button external" href="Login.aspx?ReturnUrl=<% = Request.QueryString["ReturnUrl"] %>">用户名密码登录</a>
<a class="button button-active">手机号密码登录</a>

后台

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 Mobile : 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 moblienumber = txtMobileNumber.Text;
string password = txtPassword.Text;
IAccountManager userManager = new AccountManager();
OperResult<TBUsers> operResult = userManager.LoginByMobileNumber(moblienumber, password);
if (operResult.StatusCode == Common.StatusCode.Succeed)
{
var user = operResult.ReadResult();
IdentityManager.SaveUser(user);
var url = Request.QueryString["ReturnUrl"];
if (!string.IsNullOrWhiteSpace(url))
{
Response.Redirect(url);
}
else
{
Response.Redirect("Default.aspx");
}
}
else
{
ClientScript.RegisterStartupScript(GetType(), "loginerror", $"alert('{operResult.Message}')", true);
}
}
}
}
}

上一篇:(仿支付宝支付结果页)如何实现页面广告随时上下线、过期自动下线及到时自动上线?


下一篇:12月1号