File Structure

An ASP.NET page (as opposed to a control, service, and so on) can be written in any number of languages. The most common are Visual Basic and C#. An ASP.NET page generally has several items:

  • Page directives. Information provided to the compiler about the page. For example, a directive indicating that the page uses C# as its default language is written as follows:

    <%@ Page language="C#" %>
    

    Directives normally appear at the top of the page, but may appear anywhere. (Page directives are detailed in the section “Page Directives.”)

  • Scripting. Code that is executed either by the server or the client. Several different formats exist for server-executed code:

     <% Code written here is executed %> <%= Code written here is evaluated and the ...

Get ASP.NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.