Exemple #1
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     if (!string.IsNullOrEmpty(Tool.CookieGet("YoUserID")))
     {
         MyUser = Yo_UserBLL.GetModel(Convert.ToInt32(Tool.CookieGet("YoUserID")));
         if (MyUser.IsLock)
         {
             Response.Redirect("~/LogOut.aspx");
         }
     }
     else
     {
         Response.Redirect("~/Login.aspx");
     }
 }
Exemple #2
0
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";

        // 反射方法
        string cmd = context.Request["cmd"];

        if (!string.IsNullOrEmpty(cmd))
        {
            if (cmd != "LoginUser")
            {
                if (!string.IsNullOrEmpty(Tool.CookieGet("YoUserID")))
                {
                    MyUser = Yo_UserBLL.GetModel(Convert.ToInt32(Tool.CookieGet("YoUserID")));
                    if (MyUser.IsLock)
                    {
                        context.Response.Write("{\"flag\":\"false\",\"msg\":\"用户被锁定。\"}");
                        return;
                    }
                }
                else
                {
                    context.Response.Write("{\"flag\":\"false\",\"msg\":\"未登录\"}");
                    return;
                }
            }
            System.Reflection.MethodInfo Remethod = this.GetType().GetMethod(cmd);
            if (Remethod != null)
            {
                Remethod.Invoke(this, new object[] { context });
            }
        }
        else
        {
            context.Response.Write("{\"flag\":\"false\",\"msg\":\"非法操作\"}");
        }
    }