ToMoral.Common/PageBase.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
//using LTP.Accounts.Bus;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Reflection;
using System.Text;
namespace Maticsoft.Common
{
	/// <summary>
	/// 页面层(表示层)基类,所有页面继承该页面
	/// </summary>
	public class PageBase:System.Web.UI.Page
	{
        public int PermissionID = -1;//默认-1为无限制,可以在不同页面继承里来控制不同页面的权限
        string virtualPath = Maticsoft.Common.ConfigHelper.GetConfigString("VirtualPath");
        		
		/// <summary>
		/// 构造函数
		/// </summary>
		public PageBase()
		{
            //this.Load+=new EventHandler(PageBase_Load);
		}
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Load += new System.EventHandler(PageBase_Load);
            this.Error += new System.EventHandler(PageBase_Error);
        }
        //错误处理
        protected void PageBase_Error(object sender, System.EventArgs e)
        {
            string errMsg;
            Exception currentError = Server.GetLastError();
            errMsg = "<link rel=\"stylesheet\" href=\"/style.css\">";
            errMsg += "<h1>系统错误:</h1><hr/>系统发生错误, " +
                "该信息已被系统记录,请稍后重试或与管理员联系。<br/>" +
                "错误地址: " + Request.Url.ToString() + "<br/>" +
                "错误信息: <font class=\"ErrorMessage\">" + currentError.Message.ToString() + "</font><hr/>" +
                "<b>Stack Trace:</b><br/>" +  currentError.ToString();
            Response.Write(errMsg);
            Server.ClearError();

        }
		private void PageBase_Load(object sender, EventArgs e)
		{
			if (!Page.IsPostBack )
			{

                //权限验证
                if (Context.User.Identity.IsAuthenticated)
                {
                    AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
后面还有 28 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。