【发布时间】:2011-09-11 09:44:34
【问题描述】:
我正在使用 VS 2008。我从 File->New->Website->Asp.net Website 创建了一个新的 Asp.net 网站项目。
现在我想将 Global.asax 和 .cs 文件添加到项目中。所以我右键单击项目->添加新项目->全局应用程序类。然后我点击了添加按钮。
Global.asax 文件添加了如下内容
<%@ Application Language="C#" %>
<script runat="server"%>
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
</script>
这很好。但是 Global.asax.cs 文件在哪里?
谢谢
【问题讨论】:
标签: c# asp.net .net visual-studio-2008 global-asax