ASP.NET页中`CodeFile`属性的用途是什么

编程入门 行业动态 更新时间:2024-10-19 03:35:02
本文介绍了ASP.NET页中`CodeFile`属性的用途是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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`属性的用途是什么

本文发布于:2023-11-02 14:06:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1552609.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   用途   ASP   NET   CodeFile

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!