updateuserpwd.aspx.cs
来自「精通网络应用系统开发 光盘 该书是人民邮电出版社出版的」· CS 代码 · 共 77 行
CS
77 行
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class DesktopModules_User_UpdateUserPwd : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
///判断用户是否登陆
if (Session["UserID"] == null)
{
Response.Redirect("~/Default.aspx");
}
}
protected void UpdateBtn_Click(object sender, EventArgs e)
{
///判断用户是否登录
if (Session["UserID"] == null)
{
return;
}
///判断用户输入的旧密码是否正确
UserM user = new UserM();
User recu = user.GetSingleUser(Int32.Parse(Session["UserID"].ToString()));
//判断是否为空
if (recu!=null)
{
String str = UserM.Encrypt(PasswordOld.Text.Trim());
if (recu.Password != UserM.Encrypt(PasswordOld.Text.Trim()))
{
///显示操作结果信息
Response.Write("<script>window.alert('" + ASPNET35System.PasswordErrorMESSAGE + "')</script>");
return;
}
}
else
{
///显示操作结果信息
Response.Write("<script>window.alert('" + ASPNET35System.PasswordErrorMESSAGE + "')</script>");
return;
}
try
{
///修改用户的密码
user.UpdateUserPwd(Int32.Parse(Session["UserID"].ToString()),
UserM.Encrypt(Password.Text.Trim()));
///显示操作结果信息
Response.Write("<script>window.alert('" + ASPNET35System.OPERATIONUPDATESUCCESSMESSAGE + "')</script>");
}
catch (Exception ex)
{
///显示添加操作中的失败、错误信息
Response.Redirect("~/DesktopModules/ErrorPage.aspx?ErrorUrl="
+ ASPNET35System.RedirectErrorUrl(Request.RawUrl)
+ "&ErrorMessage=" + ex.Message.Replace("\n", " "));
}
}
protected void ReturnBtn_Click(object sender, EventArgs e)
{
///返回管理页面
Response.Redirect("~/DesktopModules/User/UserManage.aspx");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?