⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 philepage.cs

📁 企业内部管理系统
💻 CS
字号:
using System;
using System.Web;
using System.Web.UI;
using System.Diagnostics;
using infoWeb.WebModules;

using infoWeb.WebModules.Accounts.Business;

namespace infoWeb.ThePhile.Web
{
	/// <summary>
	/// Summary description for PhilePage.
	/// </summary>
	public class PhilePage : System.Web.UI.Page
	{				
		public PhilePage()
		{
		}

		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);
			this.Load += new System.EventHandler(this.PhilePage_Load);
			this.Error += new System.EventHandler(this.PhilePage_Error);
		}

		protected void LogEvent(string message, EventLogEntryType entryType)
		{
			if (!EventLog.SourceExists("ThePhile.COM"))
			{
				EventLog.CreateEventSource("ThePhile.COM", "Application");
			}
			EventLog.WriteEntry("ThePhile.COM", message, entryType);
		}
		
		protected void PhilePage_Error(object sender, System.EventArgs e)
		{
			string errMsg;
			Exception currentError = Server.GetLastError();

			errMsg = "<link rel=\"stylesheet\" href=\"/ThePhile/Styles/ThePhile.CSS\">";
			errMsg += "<h1>Page Error</h1><hr/>An unexpected error has occurred on this page. The system " +
				"administrators have been notified. Please feel free to contact us with the information " +
				"surrounding this error.<br/>"+
				"The error occurred in: "+Request.Url.ToString()+"<br/>"+
				"Error Message: <font class=\"ErrorMessage\">"+ currentError.Message.ToString() + "</font><hr/>"+
				"<b>Stack Trace:</b><br/>"+
				currentError.ToString();

			if ( !(currentError is AppException) )
			{
				// It is not one of ours, so we cannot guarantee that it has been logged
				// into the event log.
				LogEvent( currentError.ToString(), EventLogEntryType.Error );
			}

			Response.Write( errMsg );
			Server.ClearError();
		}

		
		private void PhilePage_Load(object sender, System.EventArgs e)
		{
			// TODO: Place any code that will take place BEFORE the Page_Load event
			// in the regular page, e.g. cache management, authentication verification,
			// etc.											
			if (Context.User.Identity.IsAuthenticated) 
			{
				if (!(Context.User is SitePrincipal))
				{
					// ASP.NET's regular forms authentication picked up our cookie, but we
					// haven't replaced the default context user with our own. Let's do that
					// now. We know that the previous context.user.identity.name is the e-mail
					// address (because we forced it to be as such in the login.aspx page)				
					SitePrincipal newUser = new SitePrincipal( Context.User.Identity.Name );
					Context.User = newUser;
				}
			}
		}
	
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -