⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 denglu.aspx.cs

📁 本程序只要配置好IIS就可以直接使用,是一个在线网上考试系统
💻 CS
字号:
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.HtmlControls; 
using System.Drawing.Design; 
using System.Drawing; 
using System.Text.RegularExpressions;
public class imagecode : System.Web.UI.Page 
{
	protected System.Web.UI.WebControls.LinkButton ChangeCode;
	protected System.Web.UI.WebControls.Label Label1;
	protected System.Web.UI.WebControls.Label Label2;
	protected System.Web.UI.WebControls.Label Label3;
	protected System.Web.UI.WebControls.ImageButton yzm;
	protected System.Web.UI.WebControls.Button Button1;
	protected System.Web.UI.WebControls.TextBox Textpwd;
	protected System.Web.UI.WebControls.Button Button2;
	protected System.Web.UI.WebControls.Button Button3;
	protected System.Web.UI.WebControls.TextBox Txtname;
	protected System.Web.UI.WebControls.TextBox a;
	string uName,pwd;
 
	protected void Page_Load(object sender, EventArgs e) 
	{ 
		//this.CreateCheckCodeImage(RndNum()); 

	} 
	private void InitializeComponent()
	{
		this.ChangeCode.Click += new System.EventHandler(this.ChangeCode_Click);
		this.Button1.Click += new System.EventHandler(this.Button1_Click);
		this.Load += new System.EventHandler(this.Page_Load);

	}
	protected  void ChangeCode_Click(object sender, System.EventArgs e)
	{
	
	}

	protected void Button1_Click(object sender, System.EventArgs e)
	{
		uName=this.Txtname.Text;
		uName=Regex.Replace(uName,"'"," ");
//		pwd=this.Textpwd.Text;
//		pwd=Regex.Replace(pwd,"'"," ");
//		pwd=System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(this.Textpwd.Text,"MD5");
		if(this.a.Text=="")
		{
			Response.Write("<script>alert('请输入验证码!')</script>"); 
		}
		else
		{
			if (String.Compare(Request.Cookies["yzmcode"].Value, a.Text, true) != 0) 
			{ 
				Response.Write("<script>alert('验证码错误!')</script>"); 
			} 
			else 
			{ 
				if (this.Txtname.Text=="" && this.Textpwd.Text=="") 
				{
					Response.Write("<script>alert('用户名或密码不能为空!')</script>"); 
				}
				else
				{
					string strsql="select * from Users where U_Name='"+ this.Txtname.Text +"' and U_Pwd='"+ this.Textpwd.Text +"'";
					DBClass.DataClass db=new DBClass.DataClass();
					DataSet ds=new DataSet();
					ds=db.SelectData(strsql);
					if(ds.Tables[0].Rows.Count==1)
					{
						//Response.Write("<script>alert('登录成功!')</script>");
						Session["name"]=this.Txtname.Text;
						//Response.Write(Session["name"]);
						this.Response.Redirect("dengluhou.aspx");
					}
					else
					{
						Response.Write("<script>alert('用户名或密码错误')</script>");
					}
				}
			} 
		}
			
	} 

} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -