platform/Bin/App_Code/.svn/text-base/PageBase.cs.svn-base

95 lines
2.7 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 ZhangPu.Gov.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());
myLog.RequestLog logobj = new myLog.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;
}
}