zoukankan      html  css  js  c++  java
  • OnInit()方法

    1  public abstract class UserB2BPage : System.Web.UI.Page
    2 {
    3 }

    web页面继承web.UI.Page;,内容为

    1         //
    2         // 摘要:
    3         //     引发 System.Web.UI.Control.Init 事件以对页进行初始化。
    4         //
    5         // 参数:
    6         //   e:
    7         //     包含事件数据的 System.EventArgs。
    8         protected internal override void OnInit(EventArgs e);

    自己页面去重写它,如果自己登录存入的Cache为空,就跳转到登陆界面

     1         /// <summary>
     2         /// 获取当前登录用户
     3         /// </summary>
     4         public Base.UI.Model.UserB2B CurrentUser
     5         {
     6             get { return UserB2BCache.CurrentUser; }
     7         }
     8 
     9         protected override void OnInit(EventArgs e)
    10         {
    11             if (CurrentUser == null)
    12             {
    13                 Response.Redirect("~/Login.aspx");
    14             }
    15 
    16             //if (CurrentUser.Disable)
    17             //{
    18             //    Web.UI.UserController.AdminSignOut();
    19             //    Response.Redirect("~/Login.aspx");
    20             //}
    21 
    22             /*
    23             if (Program == null || !HasRight(Program.PId))
    24             {
    25                 Response.Write("您没有权限访问该页面");
    26                 Response.End();
    27             }
    28              */
    29         }
  • 相关阅读:
    dbcp 详细配置
    InetAddress
    Qrcode 二维码
    左值右值分析
    javaweb reponse 写出文件
    ehcache 在集群环境下 出现 Cause was not due to an IOException or NotBoundException
    lo4j 日志级别
    log4j xml配置
    cron 表达式
    RabbitMQ简介
  • 原文地址:https://www.cnblogs.com/Cein/p/7069093.html
Copyright © 2011-2022 走看看