第四步 WEB 展示层(显示层) UserReg.aspx.cs 页 实例
来源:互联网 发布:算法总结 编辑:程序博客网 时间:2024/06/06 06:47
2008-01-16 16:59
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;
using System.Data.SqlClient;
using Ajaxuser;
using Buygo.SQLDAL;
using Buygo.Model;
public partial class UserReg : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(Ajaxuser.pages.AjaxMethod));
if (!IsPostBack)
{
Response.Cookies.Add(new HttpCookie("CheckCode", ""));
if (this.Request["MsgID"] != null && this.txtState.Value.Trim() == "")
{
this.lberror.Text = MessageMap.GetMsg(int.Parse(this.Request["MsgID"]));
this.txtState.Value = "_";
}
}
//if (this.Request["id"] != null)
//{
// Session["id"] = this.Request["id"].ToString();
//}
}
protected void imsubmit_Click(object sender, ImageClickEventArgs e)
{
//if (Session["page"] != null)
//{
// this.Response.Redirect(Session["page"].ToString());
//}
//else
//{
string nick = this.tbMemberName.Text.Split(new char[] { '@' })[0].ToString();
//if (String.Compare(Request.Cookies["CheckCode"].Value, TextBox1.Text.ToString().Trim(), true) != 0)
//{
// Label1.Text = "验证码错误,请输入正确的验证码。";
// Label1.Visible = true;
// return;
//}
//else
//{
// Label1.Text = "验证码OK。";
// Label1.Visible = true;
this.TDMessage.InnerHtml = "";
string userID = this.tbMemberName.Text.ToString().Trim();
string pwd = this.tbPassword.Text.ToString();
string question = this.dlQuestion.SelectedItem.Value.ToString();
string answer = this.tbAnswer.Text.ToString();
pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5");
BuygoMember buygoMember = new BuygoMember();
Member member = buygoMember.InsertMember(userID, pwd, question, answer, nick);
if (member.MsgID == -1) //注册成功
{
string password = FormsAuthentication.HashPasswordForStoringInConfigFile(this.tbPassword.Text.Trim(), "MD5");
Member mem = buygoMember.Login(this.tbMemberName.Text.Trim(), password);
this.Session["Member"] = mem;
this.Response.Redirect("./personalIndex.aspx?Reg=1");
}
else
{
this.TDMessage.InnerHtml = "<font color=red>" + MessageMap.GetMsg(member.MsgID) + "</font>";
}
Response.Redirect(Session["page"].ToString());
//}
}
protected void submit_Click(object sender, EventArgs e)
{
if (this.tbxLoginName.Text.Trim() == "")
{
this.lberror.Text = "用户名不能为空!";
}
else if (this.tbxLoginPwd.Text.Trim() == "")
{
this.lberror.Text = "密码不能为空!";
}
else
{
Buygo.SQLDAL.BuygoMember buygoMember = new Buygo.SQLDAL.BuygoMember();
string password = FormsAuthentication.HashPasswordForStoringInConfigFile(this.tbxLoginPwd.Text.Trim(), "MD5");
Member member = buygoMember.Login(this.tbxLoginName.Text.Trim(), password);
Session["Member"] = member;
if (member.MsgID.ToString() == "-1")
{
this.Response.Redirect("./personalIndex.aspx");
}
else
{
this.lberror.Text = MessageMap.GetMsg(member.MsgID);
}
}
}
}
- 第四步 WEB 展示层(显示层) UserReg.aspx.cs 页 实例
- 第四步 WEB 展示层(显示层) UserReg.aspx 页 实例
- 第三步:WEB层 /展示层 UserInfo.aspx.cs 页
- 第三步:WEB层 /展示层 UserInfo.aspx 页 1
- 第三步:WEB层 /展示层 UserInfo.aspx 页(二)
- 架构B/S四 WEB 表示层 EditPassword.aspx.cs 页
- 架构B/S四 WEB 表示层 EditPassword.aspx 页
- 分页查询产品信息:第四步:创建持久化层ProductDAO
- Web显示层技术评估
- Web显示层技术评估
- Web显示层技术评估
- web开发,显示层代码
- VS web编程中 .aspx .aspx.cs
- 显示层||隐藏层
- ssh框架整合实例子-web层
- web层
- 第四层交换 (转载)
- 第四层交换 (转载)
- 了解红黑树(转)
- 第三步 SQLDAL 放操作层 (操作类) Member(一)
- 第三步 SQLDAL 放操作层 (操作类) Member(二)
- 操作类的一些SQL 储存过程
- 第四步 WEB 展示层(显示层) UserReg.aspx 页 实例
- 第四步 WEB 展示层(显示层) UserReg.aspx.cs 页 实例
- LINQ的执行时间
- 数码管扫描程序(采用数据表格)
- 3G传输网络技术及建网策略
- OracleERP表结构-INV模块
- dfg
- QQ空间的几张图
- 深入体验JAVA Web开发内幕——核心基础
- 自增操作符(华为面试)