zoukankan      html  css  js  c++  java
  • 网站简单权限管理

     

    using
    System; using System.Collections.Generic; using System.Text; using System.Web; using System.Web.UI.WebControls; namespace XX.XX.BLL.UI { public class ManagePage : System.Web.UI.Page { public ManagePage() { this.Load += new EventHandler(ManagePage_Load); } private void ManagePage_Load(object sender, EventArgs e) { //判断管理员是否登录 if (!IsAdminLogin()) { if (Core.Config.IsAgent) { Response.Write("<script>parent.location.href='/admin/login.aspx'</script>"); } else { Response.Write("<script>parent.location.href='/login.aspx'</script>"); } Response.End(); } } //public void Page_Error(Object source, EventArgs e) //{ // Exception objErr = Server.GetLastError().GetBaseException(); // JscriptMsg(objErr.Message.ToString(), "", "Error"); // Server.ClearError(); //} #region 管理员============================================ /// <summary> /// 判断管理员是否已经登录(解决Session超时问题) /// </summary> public bool IsAdminLogin() { if (Request.IsAuthenticated) { return true; } else { return false; } } /// <summary> /// 取得管理员信息 /// </summary> public Admin GetAdminInfo() { if (IsAdminLogin()) { string account = Context.User.Identity.Name; UserController UController = new UserController(); return UController.GetAdmin(account); } return null; } public bool IsMoveOut { get { if (GetAdminInfo().ServerIp.IndexOf("xx.xxx.cn") != -1) { return false; } else { return true; } } } public string _Account { get { return Context.User.Identity.Name; } } public string _AgentId { get { return GetAdminInfo().AgentId; } } #endregion #region JS提示============================================ /// <summary> /// 添加编辑删除提示 /// </summary> /// <param name="msgtitle">提示文字</param> /// <param name="url">返回地址</param> /// <param name="msgcss">CSS样式</param> protected void JscriptMsg(string msgtitle, string url, string msgcss) { string msbox = "parent.jsprint(\"" + msgtitle + "\", \"" + url + "\", \"" + msgcss + "\")"; ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox, true); } /// <summary> /// 带回传函数的添加编辑删除提示 /// </summary> /// <param name="msgtitle">提示文字</param> /// <param name="url">返回地址</param> /// <param name="msgcss">CSS样式</param> /// <param name="callback">JS回调函数</param> protected void JscriptMsg(string msgtitle, string url, string msgcss, string callback) { string msbox = "parent.jsprint(\"" + msgtitle + "\", \"" + url + "\", \"" + msgcss + "\", " + callback + ")"; ClientScript.RegisterClientScriptBlock(Page.GetType(), "JsPrint", msbox, true); } #endregion } } 然后其他的页面 都继承这个页面
    namespace xx.xxx.Web.admin.Message
    {
        public partial class EditMessage : xx.xx.BLL.UI.ManagePage
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                         }
  • 相关阅读:
    剑指offer 数值的整数次方
    剑指offer 链表中倒数第K个节点
    剑指offer反转链表
    剑指offer 栈的压入弹出 顺序
    剑指offer 二叉搜索树后续遍历序列 判断
    剑指offer 复杂链表的复制 (有向图的复制)
    剑指offer 二叉搜索树与双向链表
    2018/03/15 常用的超全局变量
    2018/03/14 每日一个Linux命令 之 ln
    PHP使用 zip 扩展压缩文件
  • 原文地址:https://www.cnblogs.com/joeylee/p/2975258.html
Copyright © 2011-2022 走看看