求一源码:c#和asp做的简单登陆注册功能
我有一年的JAVA开发经验,现在想学.NET,请大家给个源码参考下

解决方案 »

  1.   

     //登陆
        protected void btnLogin_Click(object sender, EventArgs e)
        {
           
                string uid = this.txtuid.Text;
                string pwd = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtpwd.Text, "MD5");
                if (BLLHelper.IsHaveUid(uid, pwd))
                {
                    Session["user"] = this.txtuid.Text;
                    Response.Redirect("Myproject.aspx");
                }
                else
                {
                    Response.Write("<script>alert('用户名或密码错误');</script>");
                    CreateCourse();
                }
            }
                } <table style="width: 80%;" align="center">
            <tr>
                <td class="style1">
                    用户名:
                </td>
                <td class="style2">
                    <asp:TextBox ID="txtuid" runat="server" Width="185px"></asp:TextBox>  
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="rfvuid" runat="server" ErrorMessage="用户名不能为空" ControlToValidate="txtuid"></asp:RequiredFieldValidator>   
                </td>
            </tr>
            <tr>
                <td class="style1">
                    密码:
                </td>
                <td class="style2">
                    <asp:TextBox ID="txtpwd" runat="server" TextMode="Password" 
                        style="margin-left: 0px; margin-bottom: 0px" Width="185px"></asp:TextBox>  
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="rfvpwd" runat="server" ErrorMessage="密码不能为空" ControlToValidate="txtpwd"></asp:RequiredFieldValidator>
                </td>
            </tr>
                  <tr>
            <td colspan="3" align="center">
                <asp:Button ID="btnLogin" runat="server" Text="登陆" onclick="btnLogin_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="btnRegist" runat="server" Text="注册" CausesValidation="false" 
                    onclick="btnRegist_Click" />
            </td>
            </tr>
        </table>
      

  2.   

    51aspx.com里很多
      protected void Imgbtn_ok_Click(object sender, ImageClickEventArgs e)
            {
                if (Page.IsValid)
                {
                    Sys_User user = SysUserBLL.SelectByUserId(Util.FormatInputStr(this.txtUser.Text));
                    if (user != null)
                    {
                        if (!user.PassWord.Equals(txtPwd.Text.Trim()))
                        {
                            new Jscript(this, "您输入的密码不对!").Show();
                            return;
                        }
                        else
                        {
                      
                            Session.Add("UserId", user.UserId);
                            
                            
                            this.Response.Write("<script language='javascript'>window.open('general/index.aspx','_self')</script>");
                        }
                    }
                    else
                    {
                        new Jscript(this, "您没有任何权限!").Show();
                         return;
                    }
                }
            }