Asp.net源码专业站
首页->新闻文章->达达ASP.NET简单新闻发布源码>>Admin/Admin_UserAdd.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:达达ASP.NET简单新闻发布源码
当前文件:文件类型 DaDaNews/Admin/Admin_UserAdd.aspx.cs[1K,2009-6-12 11:38:34]打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.Configuration; 4using System.Data; 5using System.Data.SqlClient; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.HtmlControls; 10using System.Web.UI.WebControls; 11using System.Web.UI.WebControls.WebParts; 12 13public partial class Admin_UserAdd : System.Web.UI.Page 14{ 15 Db pn163 = new Db(); 16 protected void Page_Load(object sender, EventArgs e) 17 { 18 if (Session["Admin"] == null) 19 { 20 Response.Redirect("./Default.aspx"); 21 } 22 } 23 protected void Button1_Click(object sender, EventArgs e) 24 { 25 26 string Name = TextBox1.Text; 27 //密码使用MD5加密 28 string Pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox2.Text.ToString(), "MD5"); 29 30 string ChkPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox3.Text.ToString(), "MD5"); 31 32 SqlConnection Conn = new SqlConnection(pn163.strConn); 33 34 35 Conn.Open(); 36 37 SqlCommand Cmd = new SqlCommand("insert into Admin(UserAdmin,UserPwd)"+"values('"+Name+"','"+Pwd+"')",Conn); 38 39 if (ChkPwd == Pwd) 40 { 41 if (Name.Trim() != "") 42 { 43 Cmd.ExecuteNonQuery(); 44 Response.Write("<script>alert('添加成功');history.go(-1);</script>"); 45 Response.Redirect("User.Aspx"); 46 } 47 else 48 { 49 Response.Write("<script>alert('用户名不能为空');history.go(-1);</script>"); 50 TextBox1.Focus(); 51 } 52 } 53 else 54 { 55 Response.Write("<script>alert('两次密码输入不一致');history.go(-1);</script>"); 56 } 57 Conn.Close(); 58 } 59} 60
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:达达ASP.NET简单新闻发布源码
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146