![21.gif](https://www.cnblogs.com/Emoticons/QQ/21.gif)
登录页面是通过<iframe src='ilogon.aspx'></iframe>,验证通过后将直接进入ilogin.aspx,使用Session保存用户状态,以下为正确登录代码:
1
private
void
btnSubmit_Click(
object
sender, System.EventArgs e)
2![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
{
3
if((Page.IsValid&&Session["ValidateCode"]!=null)&&txtValidatecode.Text.Trim().ToString()==Session["ValidateCode"].ToString())
4![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
5
//取出临时购物车CartID
6
EasybuyExcuData tempcart=new EasybuyExcuData();
7
String tempcartid=tempcart.GetCartID();
8
9
//取出用户名内容
10
string username=txtName.Text.Trim().ToString();
11
//取出密码内容
12
string pwd=txtPwd.Text.Trim().ToString();
13
// EasybuyExcuData edata=new EasybuyExcuData();
14
int userid=tempcart.UserLogin(username,pwd);
15
16
if(userid!=0)
17![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
18
Session["userid"]=userid;
19
SqlConnection con=new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
20
SqlCommand com=new SqlCommand("select count(*) from ShoppingCart where CartID= @userid",con);
21
com.Parameters.Add("@userid",SqlDbType.NVarChar,50).Value =userid.ToString();
22
23
con.Open();
24
int count=(Int32)com.ExecuteScalar();
25
con.Close();
26
if(count>0)
27![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
28
tempcart.TransplantShoppingCart(tempcartid.ToString(),userid.ToString());
29
}
30
//Response.Redirect("ilogin.aspx");
31
Response.Redirect("testiframe.htm");
32
}
33
else
34![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
35
lbMessage.Text="登录失败!请确认用户名或密码无误!";
36
//lbMessage
37
//Response.Redirect("Ilogonpage.aspx");response.redirect("welcome.aspx")
38
}
39
40
}
41
else
42![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
43
lbMessage.Text="验证码不匹配,请检查后重新输入!";
44
lbMessage.Visible=true;
45![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
46
}
47
48
}
![None.gif](/Images/OutliningIndicators/None.gif)
2
![ExpandedBlockStart.gif](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](/Images/OutliningIndicators/ContractedBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
3
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
4
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
5
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
6
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
7
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
8
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
9
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
10
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
11
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
12
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
13
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
14
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
15
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
16
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
17
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
18
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
19
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
20
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
21
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
22
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
23
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
24
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
25
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
26
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
27
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
28
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
29
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
30
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
31
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
32
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
33
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
34
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
35
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
36
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
37
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
38
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
39
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
40
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
41
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
42
![ExpandedSubBlockStart.gif](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![ContractedSubBlock.gif](/Images/OutliningIndicators/ContractedSubBlock.gif)
![dot.gif](https://www.cnblogs.com/Images/dot.gif)
43
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
44
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
45
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
46
![ExpandedSubBlockEnd.gif](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
47
![InBlock.gif](/Images/OutliningIndicators/InBlock.gif)
48
![ExpandedBlockEnd.gif](/Images/OutliningIndicators/ExpandedBlockEnd.gif)