登录与注册的页面代码 有谁知道在ASP.net程序中实现登录注册功能 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 额.....2个textbox.一个button,点击button的时候在后台select数据库,.....这个是一个高深的问题.lz慢慢研究.10年八载就应该略懂皮毛的了 用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"); } textbox前面加两个 lable 也可以啊 FCKeditor图片上传问题。 继承webControl ViewState的问题 如何得到GirdView中控件的text? 如何写哪种奇偶行不同时进行不同展示的模板? datagrid小问题,好简单的,都过来看看 哥哥姐姐,看下,membership迁移出现要求一个与架构版本“1”兼容的数据库架构 关于资源文件的问题!!!望各位大侠帮我看看该怎么做!!! 新手求助GridView问题 开发ASP.NET用VB语言好还是用C#语言好? 如何确保只有一个应用程序实例在运行(高分赠送) DBHelper中的执行带参的多条SQL语句实现事务(不要用泛型的) checkboxlist的简单问题
这个是一个高深的问题.lz慢慢研究.10年八载就应该略懂皮毛的了
从数据库建立到后台代码,都给你包办了.你也就是拖几个控件.
难度很大啊、LZ 还是慢点研究吧........
{
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");
}
textbox前面加两个 lable 也可以啊