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

标签 c# asp.net

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

<%@ 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/

相关文章:

c# - RemoteEndPoint 与 LocalEndPoint

c# - 在ContinueWith中使用Wait捕获异常是否可以?

c# - 使用 CspParameters

javascript - 您可以在 aspx 源 JavaScript 中放置预处理器或 TODO ASP.NET 标记吗?

asp.net - IIS虚拟目录到远程服务器共享文件夹:路径可能不存在,无法验证

c# - 将行添加到数据库中,获取 ID 并填充第二个表

c# - 有什么可以用 'delegate' 做但不能用 'Action' 或 'Func' 做的事情吗?

javascript - 如何通过客户端上的 JSProperties 访问 DevExpress ASPx 控件

c# - 具有多个 float 的固定位置

c# - ASP.NET & TCP 服务器解决方案