zoukankan      html  css  js  c++  java
  • COOKIES 的使用,事件控制的应用

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Default11 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Click += Button1_Click;
        }
    
        void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "zhangsan" && TextBox2.Text == "123")
            {
                //1、记住当前用户的登陆状态
                Response.Cookies.Add(new HttpCookie("UserName", TextBox1.Text));
    
                Response.Cookies["Pwd"].Value = TextBox2.Text;
    
                //2、是否需要长时间保存
                if (CheckBox1.Checked)
                {
                    Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(7);
                    Response.Cookies["Pwd"].Expires = DateTime.Now.AddDays(7);
                }
                Response.Redirect("Default12.aspx");
            }
            else
            { 
            
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Default11 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Click += Button1_Click;
        }
    
        void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "zhangsan" && TextBox2.Text == "123")
            {
                //1、记住当前用户的登陆状态
                Response.Cookies.Add(new HttpCookie("UserName", TextBox1.Text));
    
                Response.Cookies["Pwd"].Value = TextBox2.Text;
    
                //2、是否需要长时间保存
                if (CheckBox1.Checked)
                {
                    Response.Cookies["UserName"].Expires = DateTime.Now.AddDays(7);
                    Response.Cookies["Pwd"].Expires = DateTime.Now.AddDays(7);
                }
                Response.Redirect("Default12.aspx");
            }
            else
            { 
            
            }
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Default13 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Application["aaa"] = "V1.0";
        }
    }
  • 相关阅读:
    跑酷游戏的一些bug总结(滥用FixedUpdate的坑)
    Unity在编辑器状态下清空控制台信息
    Unity脚本在层级面板中的执行顺序测试3
    IronPython使用
    RSA加密的测试demo
    常用加密算法学习
    c#读写ini文件
    Jrebel激活方法(转)
    ThreadLocal Memory Leak in Java web application
    Java Thread Local – How to use and code sample(转)
  • 原文地址:https://www.cnblogs.com/suiyuejinghao123/p/5690234.html
Copyright © 2011-2022 走看看