gpt4 book ai didi

c# - 如何理解 ASP.Net 中的基本开场白,页面标签?

转载 作者:太空宇宙 更新时间:2023-11-03 17:59:43 25 4
gpt4 key购买 nike

我想知道是否有人可以向我解释这一点:

<%@ Page Title="Log In" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Login.aspx.cs" Inherits="greetwithus.Account.Login" %>

这是我在 Visual Studio 中创建一个简单的 .net Web 应用程序的时候。我显然了解标题部分,语言部分,但不了解其余部分。我想知道是否有人可以向我解释这行代码。

最佳答案

这被称为 @Page directive ,一旦你知道它们被称为指令,你可以很容易地找到帮助:)

MSDN 在这里对每个属性都有完整的描述:
http://msdn.microsoft.com/en-us/library/ydy4x04a.aspx

对于您的示例(有关更详细的说明,请参阅 msdn 链接):

  • MasterPageFile - Sets the path to the master page for the content page or nested master page. Supports relative and absolute paths. For more information, see the MasterPageFile property.
  • AutoEventWireup - Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false. The default is true. For more information, see ASP.NET Web Server Control Event Model.
  • CodeBehind - Specifies the name of the compiled file that contains the class associated with the page. This attribute is not used at run time.
  • Inherits - Defines a code-behind class for the page to inherit. This can be any class derived from the Page class. This attribute is used with the CodeFile attribute, which contains the path to the source file for the code-behind class. The Inherits attribute is case-sensitive when using C# as the page language, and case-insensitive when using Visual Basic as the page language.


如果你好奇, there are other directives as well .

关于c# - 如何理解 ASP.Net 中的基本开场白,页面标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3417818/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com