求一源码:c#和asp做的简单登陆注册功能

JAVA_STU 2010-01-06 05:38:24
求一源码:c#和asp做的简单登陆注册功能
我有一年的JAVA开发经验,现在想学.NET,请大家给个源码参考下
...全文
86 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-01-06
  • 打赏
  • 举报
回复
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;
}
}
}
zhanghang19890621 2010-01-06
  • 打赏
  • 举报
回复
//登陆
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" />
         
         
<asp:Button ID="btnRegist" runat="server" Text="注册" CausesValidation="false"
onclick="btnRegist_Click" />
</td>
</tr>
</table>

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧