温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:商务维基网源码
当前文件:
MerchantViki/adminLogin.aspx.cs,打开代码结构图
MerchantViki/adminLogin.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Data.SqlClient; 4
using System.Configuration; 5
using System.Collections; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.WebControls; 10
using System.Web.UI.WebControls.WebParts; 11
using System.Web.UI.HtmlControls; 12
//该源码下载自www.51aspx.com(51aspx.com) 13
14
public partial class SysConfigure : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
this.Header.Title = Application.Get("siteName") + "---" + this.Header.Title; 19
} 20
21
private string StringFilter(string inStr) 22
{ 23
string outStr; 24
outStr = inStr.Trim().Replace("\'", ""); 25
return outStr; 26
} 27
28
protected void AdminLoginBtn_Click(object sender, EventArgs e) 29
{ 30
if (Page.IsValid) 31
{ 32
try 33
{ 34
string conStr = Application.Get("conStr").ToString(); 35
SqlConnection sqlCon = new SqlConnection(conStr); 36
sqlCon.Open(); 37
38
string pwd = StringFilter(adminPwd.Text); 39
string pwdMD5 = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd,"MD5").ToString(); 40
41
string cmdStr = "select value from conf where type = 'adminPwd' and value = '"+pwdMD5+"'"; 42
SqlCommand sqlCmd = new SqlCommand(cmdStr, sqlCon); 43
SqlDataReader sqlDR = sqlCmd.ExecuteReader(); 44
45
bool isLogin = false; 46
47
if (sqlDR.Read()) 48
{ 49
Session.Add("admin", "true"); 50
Response.Redirect("sysconfigure.aspx"); 51
} 52
else 53
{ 54
info.Text = "口令错误!"; 55
} 56
57
sqlDR.Close(); 58
sqlCon.Close(); 59
} 60
catch (Exception ex) 61
{ 62
info.Text = "系统操纵错误:" + ex.Message; 63
} 64
} 65
} 66
} 67





}
}