| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 408 人关注过本帖
标题:登陆代码求指点!!!
只看楼主 加入收藏
qting_chh
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2012-3-31
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:3 
登陆代码求指点!!!

 <appSettings>
         <add key="user" value="admin,123456|123,11111111"></add>
    </appSettings>   cs:
  public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string loginid = this.txtlogin.Value;
            
            string pass = this.txtpass.Value;

         
           
            if (this.txtvalidae.Value.ToLower().Equals(Session["post_validate_code"].ToString().ToLower()))
            {
              
                string valid = loginid + pass;

                try
                {
                    string users = ConfigurationManager.AppSettings["user"];
                      Hashtable h = new Hashtable();
                      foreach (string s in users.Split('|'))
                      {
                          h.Add(s.Split(',')[0], s.Split(',')[1]);
                      }
                      if (h.Contains(loginid))
                    {
                        if (h[loginid].ToString() == pass)
                        {
                           
                            this.labshowerror.Text = "登录成功!";
                            FormsAuthentication.SetAuthCookie(loginid, true);

                            Session["UserInfo"] = loginid;
                            Response.Redirect("admin/index.aspx");
                        }
                        else
                            this.labshowerror.Text = "用户名或密码错误!";

                    }
                    else
                        this.labshowerror.Text = "用户名或密码错误!";


                }
                catch
                {
                    this.labshowerror.Text = "用户名或密码错误!";
                }
                //this.labshowvalidate.Text = "";
            }
           
        }
    }
点击btnLogin没反应~
搜索更多相关主题的帖子: void class public admin 
2012-03-31 09:34
xydddaxia
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:33
帖 子:466
专家分:2307
注 册:2009-3-20
收藏
得分:20 
断点调试啊?起码也报会报个什么异常之类的,看看就明白了

站在春哥的肩膀上
2012-03-31 09:42
qting_chh
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2012-3-31
收藏
得分:0 
输入信息后点击登陆后页面回发到当前页了!
2012-03-31 09:51
qting_chh
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2012-3-31
收藏
得分:0 
<asp:Button ID="btnLogin" runat="server" Text="登录"  
                OnClientClick="return CheckIn()" onclick="btnLogin_Click"/>
2012-03-31 09:53
快速回复:登陆代码求指点!!!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016529 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved