在ASP.NET用户控件的声明中CodeFile ="file.ascx.cs"和CodeBehind ="file.ascx.cs" 之间有什么区别?
是新手还是推荐?或者他们有具体用途吗?
我正在使用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 …Run Code Online (Sandbox Code Playgroud)