| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Configuration; | 
					
						
							|  |  |  |  | using System.Web; | 
					
						
							|  |  |  |  | using System.Web.Security; | 
					
						
							|  |  |  |  | using System.Web.UI; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls; | 
					
						
							|  |  |  |  | using System.Web.UI.WebControls.WebParts; | 
					
						
							|  |  |  |  | using System.Web.UI.HtmlControls; | 
					
						
							|  |  |  |  | using DeiNiu.wms.Logical; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// <summary> | 
					
						
							|  |  |  |  | /// utils 的摘要说明 | 
					
						
							|  |  |  |  | /// </summary> | 
					
						
							|  |  |  |  | public class PageBase : PagePublic | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public PageBase() | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |        | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |       | 
					
						
							|  |  |  |  |  // protected LEmployee lem; | 
					
						
							|  |  |  |  |  //  const string DefaultPage = "~/index.aspx"; | 
					
						
							|  |  |  |  |  //  const string HomePage = "~/Desktop.aspx"; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     public void CheckAuthority() | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         if (checkCloseIE()) return; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         string requestPage = Request.AppRelativeCurrentExecutionFilePath + Request.Url.Query; | 
					
						
							|  |  |  |  |         requestPage = requestPage.ToUpper(); | 
					
						
							|  |  |  |  |         //   if (DefaultPage.Equals(requestPage)) return;  //起始页不做判断 | 
					
						
							|  |  |  |  |         if (DefaultPage.ToUpper() == requestPage) return; //起始页不做判断 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         if (lem == null) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-03-06 20:48:05 +08:00
										 |  |  |  |            //logobj.LoginLog(string.Empty,"lem is null"); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             Response.Redirect(DefaultPage); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         if (HomePage.ToUpper() == requestPage) return; | 
					
						
							|  |  |  |  |         if (lem.GetEmployee.em_account == "Root") //内建管理员 | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         if (lem.AuthList.Contains(requestPage)) return; | 
					
						
							|  |  |  |  |         if (!new LRoleAuthority().GetPublicAuthorityList().Contains(requestPage)) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-03-06 20:48:05 +08:00
										 |  |  |  |            // logobj.RequestPageLog(); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |              | 
					
						
							| 
									
										
										
										
											2024-03-06 20:48:05 +08:00
										 |  |  |  |            // logobj.LoginLog(lem.GetEmployee.em_account ,"NoAccess!"); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |              | 
					
						
							|  |  |  |  |             Response.Redirect(DefaultPage); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     protected override void OnPreInit(EventArgs e) | 
					
						
							|  |  |  |  |       { | 
					
						
							|  |  |  |  |         | 
					
						
							|  |  |  |  |         base.OnPreInit(e); | 
					
						
							|  |  |  |  |        | 
					
						
							|  |  |  |  |         CheckAuthority();  | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |       } | 
					
						
							|  |  |  |  |     bool checkCloseIE() | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         if (!string.IsNullOrEmpty(Request.QueryString["___command"])) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string cmd = Request.QueryString["___command"]; | 
					
						
							|  |  |  |  |             if (cmd == "ClearSession") | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if ((Session["CurrentUser"] != null)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     if (System.Configuration.ConfigurationManager.AppSettings["sessionstate"] != "InProc") | 
					
						
							|  |  |  |  |                         if (Session["CurrentUserId"] != null) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             //   ((ArrayList)Application["userlst"]).Remove(Session["CurrentUserAccount"].ToString()); | 
					
						
							|  |  |  |  |                             DeiNiu.RequestLog logobj = new DeiNiu.RequestLog(); | 
					
						
							| 
									
										
										
										
											2024-03-06 20:48:05 +08:00
										 |  |  |  |                           //  logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString())); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |                         } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 Session.Abandon(); //清空Session, all sessions will be clear ? no kiding, it will obsolete the current session. | 
					
						
							|  |  |  |  |                 return true; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         return false; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | } |