ASP.NET页中CodeFile属性的用途是什么?
What is the use of the CodeFile attribute in an ASP.NET page ?
推荐答案CodeFile属性用于部署单个页面而不部署整个应用程序:-
CodeFile attribute is used for deploying a single page without deploying the whole application :-
以下是将单个页面部署到Web应用程序的说明.以下示例使用页面/Forms/CreateUser.aspx
Here are the instructions to deploy a single page to a web application. The following example is using the page /Forms/CreateUser.aspx
在.cs文件中,将类的名称更改为不存在的名称.例如,更改以下内容:
In the .cs file change the name of the class to one that doesn't exist. For example, change the following:
public partial class CreateUser : System.Web.UI.Page收件人:
public partial class CreateUser1 : System.Web.UI.Page在aspx,ascx,master等中,将Codebehind更改为CodeFile,并将在Inherits属性中指定的类的名称更改为与.cs文件中的名称相同.例如,更改以下内容:
In the aspx, ascx, master, etc. change the Codebehind to CodeFile and change the name of the class specified in the Inherits attribute to the same name as in the .cs file. For example change the following:
Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeBehind="CreateUser.aspx.cs" Inherits="Forms.CreateUser"收件人:
Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="CreateUser.aspx.cs" Inherits="Forms.CreateUser1"更多推荐
ASP.NET页中`CodeFile`属性的用途是什么
发布评论