登录与注册的页面代码
有谁知道在ASP.net程序中实现登录注册功能。。。 --------------------编程问答-------------------- 让人怎么回答呢?直接写就是了 --------------------编程问答-------------------- --------------------编程问答-------------------- 额.....2个textbox.一个button,点击button的时候在后台select数据库,.....这个是一个高深的问题.lz慢慢研究.10年八载就应该略懂皮毛的了 --------------------编程问答-------------------- 楼上正解 --------------------编程问答-------------------- 51aspx.com里很多
--------------------编程问答-------------------- 用ASP.NET自带的用户/角色系统,
从数据库建立到后台代码,都给你包办了.你也就是拖几个控件. --------------------编程问答-------------------- 两个textbox 两个button 加一个容器 ok
难度很大啊、LZ 还是慢点研究吧........
--------------------编程问答-------------------- 晕。。这个随便都一大堆啊。。 --------------------编程问答--------------------
我不会。。。 --------------------编程问答-------------------- 一个用户名框,一个密码框,一个登录按扭,Click 登录了 --------------------编程问答-------------------- 给个登录的你吧。注册的,,,太。。
--------------------编程问答--------------------
if (!HttpContext.Current.User.Identity.IsAuthenticated)
{
string strName = Request.Form["username"];
string strPwd = Request.Form["password"];
//验证
string sd = FormsAuthentication.HashPasswordForStoringInConfigFile(strPwd.Trim(), "MD5").ToString().ToLower().Substring(8, 16);
System.Data.DataSet ds = new BLL.web_user().GetList(" username='" + strName + "' and userpwd='" + sd + "'");
bool f = false;//是否保存登录状态
if (this.sty.Checked)
{
f = true;
}
if (ds.Tables[0].Rows.Count > 0)
{
//验证成功
string strURL = System.Web.Security.FormsAuthentication.GetRedirectUrl(System.Web.Security.FormsAuthentication.FormsCookieName, true);//这个是用户请求的页面路径
System.Web.Security.FormsAuthentication.SetAuthCookie(ds.Tables[0].Rows[0]["username"].ToString(), f);//给用户颁发Cookie凭证
if (strURL == null)
{
//用户原请求页面为空时
Response.Redirect("/default.aspx");
}
else
{
Response.Redirect(strURL);//用户原请求页面不为空时,转到请求页面
}
}
else
{
this.sty.Checked = false;
Common.MessageBox.Show(Page, "用户名密码不一致!");
}
}
else
{
Common.MessageBox.ShowAndRedirect(this.Page, "请不要重复登录!","/default.aspx");
}
你认为LZ看得懂你的代码么? --------------------编程问答-------------------- 这是最最最基本的东东。。。
建议楼主自已动手写写吧。。 --------------------编程问答--------------------
textbox前面加两个 lable 也可以啊
补充:.NET技术 , ASP.NET