博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
20151223:Web:审核:登陆
阅读量:6614 次
发布时间:2019-06-24

本文共 1554 字,大约阅读时间需要 5 分钟。

aspx代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DengLu.aspx.cs" Inherits="DengLu" %>

    登录

 

 

  

    

      

cs代码:

using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class DengLu : System.Web.UI.Page{    private UsersDataContext context = new UsersDataContext();    protected void Page_Load(object sender, EventArgs e)    {    }    protected void Button1_Click(object sender, EventArgs e)    {        //取值        string uid = TextBox1.Text;        string pwd = TextBox2.Text;        //查数据库        var query = context.users.Where(p => p.UserName == uid && p.PassWord == pwd);        if(query.Count()>0)        {            int state = query.First().State.Value;            if (state == 0)            {                Literal1.Text = "";            }            else if(state == 1)            {                Session["uid"] = uid;                Response.Redirect("Main.aspx");            }            else            {                Literal1.Text = "";            }                 }        else        {            Literal1.Text = "";        }    }}

转载于:https://www.cnblogs.com/mn-b/p/5079181.html

你可能感兴趣的文章