Kev*_*Kev 3 asp.net visual-studio-2008 global-asax
通常我会创建Web应用程序项目并使用代码隐藏,但我需要使用代码内联创建一个小的一次性演示应用程序.
我添加了一个Global.asax文件的应用程序,但对于一些奇怪的原因时,Visual Studio 2008 SP1不会让我编辑任何脚本标签之间的IE代码添加到事件处理程序,例如Application_Start,Session_Start.但是VS让我在脚本标签之外进行编辑.
这只是一个使用内置Web服务器的基于文件的简单Web应用程序.
有什么想法发生了什么?
这是代码内联global.asax VS创建:
<%@ 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>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1673 次 |
| 最近记录: |