看看你Gloabl.asax.cs关于Gloabl类的定义和所属命名空间对不对:
using System;
using System.Diagnostics;
using System.Collections;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
namespace Wrox.ThePhile.Web
{
/// <summary>
/// Summary description for Global.
/// </summary>
public class Global : System.Web.HttpApplication
{
public Global()
{
InitializeComponent();
}
protected void Application_Error(Object sender, EventArgs e)
{
string errMsg = "<link rel=\"stylesheet\" href=\"/ThePhile/Styles/ThePhile.CSS\">";
errMsg += "<h1>Application Error</h1><hr/>An unexpected error has occurred in this Application. 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\">"+Server.GetLastError().Message.ToString()+"</font><hr/>"+
"<b>Stack Trace:</b><br/>"+
Server.GetLastError().ToString();
Response.Write( errMsg );
if (!EventLog.SourceExists("ThePhile.COM"))
{
EventLog.CreateEventSource("ThePhile.COM", "Application");
}
EventLog.WriteEntry("ThePhile.COM", Server.GetLastError().Message, EventLogEntryType.Error);
#region Web Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}