95 lines
2.7 KiB
C#
95 lines
2.7 KiB
C#
|
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)
|
|||
|
{
|
|||
|
//logobj.LoginLog(string.Empty,"lem is null");
|
|||
|
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))
|
|||
|
{
|
|||
|
// logobj.RequestPageLog();
|
|||
|
|
|||
|
// logobj.LoginLog(lem.GetEmployee.em_account ,"NoAccess!");
|
|||
|
|
|||
|
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();
|
|||
|
// logobj.LogoutLog(int.Parse(Session["CurrentUserId"].ToString()));
|
|||
|
}
|
|||
|
}
|
|||
|
Session.Abandon(); //清空Session, all sessions will be clear ? no kiding, it will obsolete the current session.
|
|||
|
return true;
|
|||
|
}
|
|||
|
}
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
}
|