log.aspx.cs
资源名称:WebSite1.rar [点击查看]
上传用户:vtryaojia
上传日期:2020-04-18
资源大小:1214k
文件大小:2k
源码类别:
SCSI/ASPI
开发平台:
Others
-
- 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;
- using System.Data.OleDb;
- using System.Text;
- using System.Security.Cryptography;
- public partial class log : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void logButton_Click1(object sender, EventArgs e)
- {
- if (UserName.Text == "")
- {
- if (Password.Text == "")
- {
- Response.Write("<script>alert('用户名和密码不能为空')</script>");
- }
- else
- {
- Response.Write("<script>alert('用户名和密码不能为空')</script>");
- }
- }
- string strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/App_Data/zzu.mdb") + ";";
- OleDbConnection conn = new OleDbConnection(strConnection);
- conn.Open();
- OleDbCommand cmd1 = new OleDbCommand("select*from [Member] where name='" + UserName.Text.ToString() + "'and password='" + Password.Text.ToString() + "'");
- cmd1.Connection = conn;
- OleDbDataReader dr = cmd1.ExecuteReader();
- if (dr.Read())
- {
- Session["name"] = dr["name"].ToString();
- Session.Add("password", Password.Text);
- Response.Redirect("GoodsList.aspx");
- }
- else
- {
- Response.Write("<script>alert('用户名或密码错误')</script>");
- UserName.Text = "";
- Password.Text = "";
- }
- conn.Close();
- }
- protected void regButton_Click(object sender, EventArgs e)
- {
- Response.Redirect("reg.aspx");
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- Response.Redirect("zhaohuimima.aspx");
- }
- protected void back_Click(object sender, EventArgs e)
- {
- Response.Write("<script language=javascript>history.go(-2);</script>");
- }
- }