zoukankan      html  css  js  c++  java
  • Session 传值

    Session

    保存在服务器上
    很安全
    占用服务器资源
    只有会话模式   20分钟生命周期
    可以存任意数据类型,Object,取的时候需要类型转换
    服务器内存

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Default1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Click += Button1_Click;
        }
    
        void Button1_Click(object sender, EventArgs e)
        {
            string uname = TextBox1.Text;//获取用户输入的用户名   
            string pwd = TextBox2.Text;//获取用户输入的密码
            Users u = new UsersData().SelectUser(uname, pwd);
            Session["hehe"] = u;//传值
            Response.Redirect("Default5.aspx");//跳到Default5.aspx
        }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    public partial class Default5 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["hehe"] != null)//不为空的时候执行
                Label1.Text = (Session["hehe"] as Users).NickName;//接受传过来的值  Session["hehe"] as Users变成对象
        }
    }
  • 相关阅读:
    Certificate、Provisioning Profile、App ID
    boundingRectWithSize
    IOS照片框架
    UIlabel 属性text
    UIMenuController的使用,对UILabel拷贝以及定制菜单
    iOS 自定义emoji表情键盘
    IOS第三方字体
    IOS 验证码
    网上收集的以及自己总结的iOS开发技巧
    给自己一个坚持下去的理由
  • 原文地址:https://www.cnblogs.com/skyhorseyk/p/7299544.html
Copyright © 2011-2022 走看看