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 System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Reflection;
using System.Text;
namespace Common
{
/// <summary>
/// 页面层(表示层)基类,所有页面继承该页面
/// </summary>
public class PageBase : System.Web.UI.Page
{
//public int PermissionID = -1;//默认-1为无限制,可以在不同页面继承里来控制不同页面的权限
//string virtualPath = LTP.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)
{
}
private void PageBase_Load(object sender, EventArgs e)
{
System.Web.UI.HtmlControls.HtmlHead hdd = new HtmlHead();
Literal lis = new Literal();
lis.Text = "/n<script language=/"javascript/" type=/"text/javascript/" src=/"JScript.js/"></script>/n<meta name=/"keywords/" content=/"关键字/">/n";
Header.Controls.Add(lis);
string IncludeScript = @"/js/ShowHello.js";
string includes = @"/js/ch.js";
Page.ClientScript.RegisterClientScriptInclude("includeKey", IncludeScript);
}
}
//错误处理
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();
}
}