Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
getPassword.aspx.cs
Package: MEIMS.rar [view]
Upload User: ah_jiwei
Upload Date: 2022-07-24
Package Size: 54044k
Code Size: 2k
Category:
ADO-ODBC
Development Platform:
Visual C++
- 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.SqlClient;
- public partial class getPassword : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- //注册按钮
- protected void Button1_Click(object sender, EventArgs e)
- {
- }
- //登陆按钮
- protected void Button2_Click(object sender, EventArgs e)
- {
- string userId = TextBox1.Text.ToString().Trim();
- string password = TextBox2.Text.ToString().Trim();
- SqlConnection con = DB.connect_la();
- try
- {
- con.Open();
- string commandString = "select * from id_password_role where id = '" + userId + "' and password= '" + password + "'";
- SqlCommand cmd = new SqlCommand(commandString, con);
- SqlDataReader sdr = cmd.ExecuteReader();
- if (sdr.Read())
- {
- string role_log = sdr.GetString(2);
- Session["userId"] = userId;
- if (role_log.StartsWith("t"))
- Response.Redirect("teacher/index.aspx?");
- else if (role_log.StartsWith("s"))
- Response.Redirect("student/index.aspx?");
- else if (role_log.StartsWith("a"))
- Response.Redirect("administration/index.aspx?");
- }
- else
- {
- Response.Write("<script>alert('用户名或密码错误!');window.location='login.aspx'</script>");
- }
- sdr.Close();
- con.Close();
- }
- catch (Exception exception)
- {
- Response.Write("<script>alert('数据库读取异常!');window.location='login.aspx'</script>");
- }
- finally
- {
- if (con.State == ConnectionState.Open)
- {
- con.Close();
- }
- }
- }
- }