protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "OutOnline") { FrameWorkPermission.CheckPermissionVoid(PopedomType.Delete); //FrameWorkPermission.UserOnlineList.RemoveUserName(e.CommandArgument.ToString().ToLower()); FrameWorkOnline.Instance().OnlineRemove(e.CommandArgument.ToString().ToLower()); MessageBox MBx = new MessageBox(); MBx.M_Type = 2; MBx.M_Title = "强制用户退出!"; MBx.M_IconType = Icon_Type.Error; MBx.M_Body = string.Format("强制用户({0})退出成功!", e.CommandArgument.ToString()); MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", Common.GetHomeBaseUrl("default.aspx"), "", UrlType.Href, true)); EventMessage.MessageBox(MBx); } }
protected void Page_Load(object sender, EventArgs e) { string CMD =(string) Common.sink("CMD", MethodType.Get, 255, 0, DataType.Str); if (!Page.IsPostBack) { MessageBox MBx = new MessageBox(); ArrayList lst = new ArrayList(); if (CMD == "AppError") { List<sys_NavigationUrl> ListUrl = new List<sys_NavigationUrl>(); ListUrl.Add(new sys_NavigationUrl("确定", "default.aspx", "", UrlType.Href, true)); MBx.M_Body = "抱歉,处理您的请求时发生了错误。错误信息已被记录,我们将追踪解决。"; MBx.M_Title = "系统错误"; MBx.M_IconType = Icon_Type.Error; MBx.M_ButtonList = ListUrl; } else { string CookiesKey = string.Format("{0}-MessageValue", Common.Get_CookiesName); //if (Session[string.Format("{0}-MessageValue", Common.Get_CookiesName)] != null) //if (FrameWorkCache.Instance()[CookiesKey]!=null) //{ string MessageValue = Request.Cookies[CookiesKey].Value.ToString(); //Response.Write(MessageValue); //Response.Write("<br>-------------------------<br>"); //Response.Write(Request.Cookies[CookiesKey+"1"].Value.ToString()); if (MessageValue != "") { MBx = EventMessage.Deserialize_MessageBox(EventMessage.Deserialize_MessageBox(MessageValue,true)); } //MBx = (MessageBox)Session[string.Format("{0}-MessageValue", Common.Get_CookiesName)]; //MBx = (MessageBox)FrameWorkCache.Instance()[CookiesKey]; //} } ReturnScript = MBx.M_ReturnScript; Header.Title = MBx.M_Title; lst.Add(MBx); MessageDispBox.DataSource = lst; MessageDispBox.DataBind(); } }
/// <summary> /// 处理认证成功事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void app_Auth(object sender, EventArgs e) { //判断是否在manager目录里 if (Common.GetCharInStringCount("/manager/", Common.GetScriptUrl.ToLower()) > 0) { //判断文件名是否为aspx if (Common.GetScriptNameExt.ToLower() == "aspx") { //判断 if (Common.Get_UserID != 0) { //判断在线用户 //if (UserOnlineList.CheckMemberOnline(UserData.GetUserDate.U_LoginName.ToLower(), Common.Get_UserID)) //{ // UserOnlineList.Access(Common.Get_UserID, Common.GetScriptUrl); //} //string abc = Common.GetSessionID; if (FrameWorkOnline.Instance().CheckUserInOnline(UserData.GetUserDate.U_LoginName,Common.SessionID)) { FrameWorkOnline.Instance().OnlineAccess(UserData.GetUserDate.U_LoginName); } else { if (Common.OnlineMinute != 0) { FrameWorkLogin.UserOut(); MessageBox MBx = new MessageBox(); MBx.M_Type = 2; MBx.M_Title = "没有登陆!"; MBx.M_IconType = Icon_Type.Error; MBx.M_Body = "您已经被系统强制退出!"; MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "~/Manager/default.aspx", "", UrlType.Href, true)); EventMessage.MessageBox(MBx); } } //检测权限 if (!Check_Permission) { MessageBox MBx = new MessageBox(); MBx.M_Type = 2; MBx.M_Title = "权限出错"; MBx.M_IconType = Icon_Type.Error; MBx.M_Body = "无权访问当前页面!"; MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "history.back();", "", UrlType.JavaScript, true)); EventMessage.MessageBox(MBx); } //更新当前用户最后访问记录 if (Common.GetDBType == "Oracle") BusinessFacade.Update_Table_Fileds("sys_User", string.Format("U_LastIP='{0}',U_LastDateTime=to_date('{1}','yyyy-mm-dd HH24:MI:SS')", Common.GetIPAddress(), DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss")), string.Format("UserID={0}", Common.Get_UserID)); else BusinessFacade.Update_Table_Fileds("sys_User", string.Format("U_LastIP='{0}',U_LastDateTime='{1}'", Common.GetIPAddress(), DateTime.Now.ToString("yyyy/MM/dd hh:mm:ss")), string.Format("UserID={0}", Common.Get_UserID)); //写访问日志 if (FrameSystemInfo.GetSystemInfoTable.S_SystemConfigData.C_RequestLog) EventMessage.EventWriteDB(3, "访问网页"); } } } }
protected void Button1_Click(object sender, EventArgs e) { MessageBox MBx = new MessageBox(); MBx.M_Type = 2; MBx.M_Title = "登陆出错!"; MBx.M_IconType = Icon_Type.Error; MBx.M_Body = "验证码无效,请确认您输入的验证码有效!"; //string UserKey = sLoginName + Common.GetIPAddress().Replace(".", ""); if (FrameWorkLogin.GetLoginUserError(UserKey) > 2 && (Session["CheckCode"] == null || sCode_op != Session["CheckCode"].ToString())) { MBx.M_WriteToDB = false; MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "login.aspx", "点击按钮重新输入验证码!", UrlType.Href, true)); } else if (!FrameWorkLogin.CheckDisableLoginUser(UserKey)) { MBx.M_Body = string.Format("此用户:{0},IP:{1}登陆出错次数超过系统允许,已经禁止登陆.请联系管理员!", sLoginName, Common.GetIPAddress()); MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "login.aspx", "点击按钮返回!", UrlType.Href, true)); } else if (new FrameWorkLogin().CheckLogin(sLoginName, sLoginPass,UserKey)) { MBx.M_IconType = Icon_Type.OK; MBx.M_Title = "登陆成功!"; MBx.M_Body = string.Format("欢迎您{0},成功登入。您的IP为:{1}!", sLoginName, Common.GetIPAddress()); MBx.M_WriteToDB = false; MBx.M_ButtonList.Add(new sys_NavigationUrl("确定", "default.aspx", "点击按钮登陆!", UrlType.Href, true)); FrameWorkLogin.MoveErrorLoginUser(UserKey); //写登入日志 EventMessage.EventWriteDB(2, MBx.M_Body, UserData.Get_sys_UserTable(sLoginName).UserID); } else { MBx.M_Body = string.Format("用户名/密码({0}/{1})错误!", sLoginName, sLoginPass); MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "login.aspx", "点击按钮重新输入!", UrlType.Href, true)); } Session["CheckCode"] = Common.RndNum(4); EventMessage.MessageBox(MBx); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //清除在线用户 FrameWorkOnline.Instance().ClearOnlineUserTimeOut(); } if (HttpContext.Current.User.Identity.IsAuthenticated) { Response.Redirect("default.aspx"); } FrameName = FrameSystemInfo.GetSystemInfoTable.S_Name; FrameNameVer = FrameSystemInfo.GetSystemInfoTable.S_Version; //Button1.Attributes.Add("Onclick", "javascript:return checkForm(ctl00);"); string CMD = (string)Common.sink("CMD", MethodType.Get, 255, 0, DataType.Str); if (CMD == "OutOnline") { string U_LoginName = (string)Common.sink("U_LoginName", MethodType.Get, 20, 1, DataType.Str); string U_Password = (string)Common.sink("U_Password", MethodType.Get, 32, 32, DataType.Str); string OPCode = (string)Common.sink("OPCode", MethodType.Get, 4, 4, DataType.Str); MessageBox MBx = new MessageBox(); MBx.M_Type = 2; MBx.M_Title = "强制下线!"; MBx.M_IconType = Icon_Type.Error; MBx.M_Body = "强制下线失败.验证码无效,请确认您输入的验证码有效!"; if (Session["CheckCode"] == null || OPCode.ToLower() != Session["CheckCode"].ToString()) { MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "login.aspx", "点击按钮重新输入验证码!", UrlType.Href, true)); } else { QueryParam qp = new QueryParam(); qp.Where = string.Format(" Where U_StatUs=0 and U_LoginName='{0}' and U_Password='******'", Common.inSQL(U_LoginName), Common.inSQL(U_Password)); int iInt = 0; ArrayList lst = BusinessFacade.sys_UserList(qp, out iInt); if (iInt > 0) { //FrameWorkPermission.UserOnlineList.RemoveUserName(U_LoginName.ToLower()); string sessionid = (string)Common.sink("SessionID", MethodType.Get, 24, 0, DataType.Str); FrameWorkOnline.Instance().OnlineRemove(sessionid); MBx.M_IconType = Icon_Type.OK; MBx.M_Body = string.Format("强制帐号{0}下线成功.请重新登陆!", U_LoginName); MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "login.aspx", "", UrlType.Href, true)); } else { MBx.M_Body = "强制下线失败.用户名/密码无效!"; MBx.M_ButtonList.Add(new sys_NavigationUrl("返回", "login.aspx", "", UrlType.Href, true)); } } Session["CheckCode"] = Common.RndNum(4); EventMessage.MessageBox(MBx); } if (FrameWorkLogin.GetLoginUserError(UserKey) <= 2) { Logincode_op.Src = "images/Logon/Logon_7no.gif"; inputcode_op.Visible = false; } }
/// <summary> /// 序列化MessageBox类 /// </summary> /// <param name="MBx">MessageBox类</param> /// <returns>字符数组</returns> public static byte[] Serializable_MessageBox(MessageBox MBx) { IFormatter formatter = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); byte[] b; formatter.Serialize(ms, MBx); ms.Position = 0; b = new byte[ms.Length]; ms.Read(b, 0, b.Length); ms.Close(); return b; }
/// <summary> /// 信息提示 /// </summary> /// <param name="MBx">信息提示类</param> public static void MessageBox(MessageBox MBx) { if (MBx.M_WriteToDB) { EventWriteDB(MBx.M_Type, MBx.M_Body); } if (MBx.M_ButtonList.Count > 0) { System.Web.HttpContext.Current.Response.Cookies[string.Format("{0}-MessageValue",Common.Get_CookiesName)].Value = Serializable_MessageBox(Serializable_MessageBox(MBx),true); //System.Web.HttpContext.Current.Response.Cookies[string.Format("{0}-MessageValue1", Common.Get_CookiesName)].Value = Serializable_MessageBox(Serializable_MessageBox(MBx), false); //System.Web.HttpContext.Current.Session[string.Format("{0}-MessageValue", Common.Get_CookiesName)] = MBx; //FrameWorkCache.Instance().Insert(string.Format("{0}-MessageValue", Common.Get_CookiesName), MBx); System.Web.HttpContext.Current.Response.Redirect(string.Format("~/Manager/Messages.aspx?OPID={0}",Common.RndNum(5))); } }
/// <summary> /// 信息提示 /// </summary> /// <param name="M_Type">类型1:操作日志2:安全日志</param> /// <param name="M_Title">标题</param> /// <param name="M_Body">内容</param> /// <param name="M_IconType">icon类型</param> /// <param name="M_WriteToDB">是否写入db</param> /// <param name="M_ButtonList">按钮类型</param> /// <param name="M_ReturnScript">执行Script脚本字符串(需加<script></script>)</param> public static void MessageBox(int M_Type, string M_Title, string M_Body, Icon_Type M_IconType, bool M_WriteToDB, List<sys_NavigationUrl> M_ButtonList, string M_ReturnScript) { MessageBox mbx = new MessageBox(); mbx.M_Body = M_Body; mbx.M_ButtonList = M_ButtonList; mbx.M_IconType = M_IconType; mbx.M_Title = M_Title; mbx.M_Type = M_Type; mbx.M_WriteToDB = M_WriteToDB; mbx.M_ReturnScript = M_ReturnScript; MessageBox(mbx); }