zoukankan      html  css  js  c++  java
  • 手写登录

    namespace X
    {
         public class Login:System.Web.UI.Page
    {
        protected string PreUserName={get;set;}
    protected string Js={get;set;}
    protected void Load_Page(object sender,EventAges e)
    {
        if(!IsPostBack)
    {
        PreUserName=Request.Cookies["txtusername"]==null?string.Empty:Request.Cookies["txtusername"].value;
     
    }
    else
    {
        PreUserName=Request["txtLoginName"];
    }
     
    }
    protected void btnLoginClick(object sender,ImageButtonEventAges e)
    {
        string sendCode=Session["ValidateCode"]==null?String.Empty:Session["ValidateCode"].ToString();
        string reviceCode=Request["txtCode"];
    if(!sendCode.Equals(reviceCode))
    {
       Js="<script>alert('验证码不正确')</script>";
    return ;
    }
    string struserName=Request["txtLoginName"];
    string strPwd=Request["txtPwd"];
    BLL.CZBK_user Infouserservice=new CZBK_user();
    Model.CZBK_user user=Infouserservice.getModelList(userName,Password);
        if(user==null)
    {
        Js="<script>alert('用户名和密码不正确')</script>";
    return;
    }
    Session["txtLoginName"]=user;
    string name=Request["txtLogin"];
    if(!string.IsNullOrEmpty(name))
    {
        Response.Cookies["struserName"]=name;
    Response.Cookies["struserName"].Expirse=DateTime.Now.AddDays(7);
    }
    Response.Redirct("AdminIndex.aspx");
    }
    }
    }
  • 相关阅读:
    设计模式之开篇(C#语法) 爱拼才会赢
    C#语法糖之第一篇:自动属性&隐式类型 爱拼才会赢
    C#语法糖之第四篇: 扩展方法 爱拼才会赢
    C#中this在扩展方法的应用
    笔记20120215_转义字符_运算符
    Linux基本操作
    SQL创表
    软件测试的概念
    java 线程池
    Redis广播
  • 原文地址:https://www.cnblogs.com/nieyulin123/p/3068236.html
Copyright © 2011-2022 走看看