开发者

How to understand a basic opener in ASP.Net, page tag?

I was wondering if anyone could explain this to me:

<%@ Page Title="Log In" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Login.aspx.c开发者_运维百科s" Inherits="greetwithus.Account.Login" %>

This is when I create a simple .net web application in visual studio. I obviously understand the title part, language part, but not the rest. I was wondering if someone could explain this line of code to me.


This is known as the @Page directive, once you know they're called directives, you can find help pretty easily :)

MSDN has a full description of every atribute here: http://msdn.microsoft.com/en-us/library/ydy4x04a.aspx

For your example (see the msdn link for even more detailed descriptions):

  • 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.

If you're curious, there are other directives as well.


This is known as a Page Directive. You can read more about it on the MSDN topic here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜