I was wondering if anyone could explain this to me:
<%@ Page Title="Log In" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Login.aspx.cs" Inherits="greetwithus.Account.Login" %>
Run Code Online (Sandbox Code Playgroud)
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.
这被称为@Page指令,一旦你知道它们被称为指令,你可以很容易地找到帮助:)
MSDN在此处对每个属性进行了完整描述:http: //msdn.microsoft.com/en-us/library/ydy4x04a.aspx
对于您的示例(有关更详细的说明,请参阅msdn链接):
- MasterPageFile - 设置内容页面或嵌套母版页的母版页的路径.支持相对和绝对路径.有关更多信息,请参阅MasterPageFile属性.
- AutoEventWireup - 指示页面的事件是否自动装配.如果启用了事件自动装配,则为true; 否则,错误.默认值为true.有关更多信息,请参阅ASP.NET Web服务器控件事件模型.
- CodeBehind - 指定包含与页面关联的类的已编译文件的名称.运行时不使用此属性.
- 继承 - 为要继承的页面定义代码隐藏类.这可以是从Page类派生的任何类.此属性与CodeFile属性一起使用,该属性包含代码隐藏类的源文件的路径.使用C#作为页面语言时,Inherits属性区分大小写,而使用Visual Basic作为页面语言时,不区分大小写.
如果你很好奇,还有其他指令.