您目前尚未登陆,请选择【登陆】或【注册
首页->其他源码->商务维基网源码>>UserLogin.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:商务维基网源码
当前文件:文件类型 MerchantViki/UserLogin.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Data; 3using System.Data.SqlClient; 4using System.Configuration; 5using System.Collections; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.WebControls; 10using System.Web.UI.WebControls.WebParts; 11using System.Web.UI.HtmlControls; 12 13public partial class SysConfigure : System.Web.UI.Page 14{ 15 protected void Page_Load(object sender, EventArgs e) 16 { 17 this.Header.Title = Application.Get("siteName") + "---" + this.Header.Title; 18 } 19 20 private string StringFilter(string inStr) 21 { 22 string outStr; 23 outStr = inStr.Trim().Replace("\'", ""); 24 return outStr; 25 } 26 27 protected void UserLoginBtn_Click(object sender, EventArgs e) 28 { 29 if (Page.IsValid) 30 { 31 try 32 { 33 string conStr = Application.Get("conStr").ToString(); 34 SqlConnection sqlCon = new SqlConnection(conStr); 35 sqlCon.Open(); 36 37 string unStr = StringFilter(userName.Text); 38 string pwdStr = StringFilter(pwd.Text); 39 string pwdMD5 = FormsAuthentication.HashPasswordForStoringInConfigFile(pwdStr,"MD5").ToString(); 40 41 string cmdStr = "select point from userInfo where name = '"+unStr+"' and pwd = '"+pwdMD5+"'"; 42 SqlCommand sqlCmd = new SqlCommand(cmdStr, sqlCon); 43 SqlDataReader sqlDR = sqlCmd.ExecuteReader(); 44 45 if (sqlDR.Read()) 46 { 47 if (Session["userName"] != null) 48 Session["userName"] = unStr; 49 else 50 Session.Add("userName", unStr); 51 52 if (Session["userPoint"] != null) 53 Session["userPoint"] = sqlDR.GetValue(0).ToString(); 54 else 55 Session.Add("userPoint", sqlDR.GetValue(0).ToString()); 56 57 Response.Redirect("Default.aspx"); 58 } 59 else 60 { 61 info.Text = "登陆错误!"; 62 } 63 64 sqlDR.Close(); 65 sqlCon.Close(); 66 } 67 catch (Exception ex) 68 { 69 info.Text = "系统操纵错误:" + ex.Message; 70 } 71 } 72 } 73} 74
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:商务维基网源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号