页面如下:

源码html比较简单,就不写出来了。直接看一下后台代码吧!
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int Count = DB.ExecuteScalar("select count(*) from admin where admin='"+TextBox1 .Text +"'and pwd='"+TextBox2 .Text +"'");
if (Count > 0)
Response.Redirect("admin.aspx");
else
Response.Write("用户名或密码错误!请重新登录!");
}
}
本文介绍了一个简单的登录验证系统的实现过程,使用ASP.NET进行页面搭建,并通过SQL查询来验证用户名及密码是否正确。若验证成功则跳转到管理页面,否则提示用户重新输入。
1415

被折叠的 条评论
为什么被折叠?



