Your first ASP.net page : Introduction « ASP.Net Instroduction « ASP.NET Tutorial






<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    void Page_Load()
    {
        lblServerTime.Text = DateTime.Now.ToString();
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>First Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    The current date and time is:

    <asp:Label
        id="lblServerTime"
        Runat="server" />

    </div>
    </form>
</body>
</html>



The first line contains a directive. It looks like this:

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


The code declaration block contains all the methods used in the page. 
It contains all the page's functions and subroutines. 


<script runat="server">

    void Page_Load()
    {
        lblServerTime.Text = DateTime.Now.ToString();
    }

</script>








1.1.Introduction
1.1.1.Your first ASP.net page
1.1.2.The ASP.NET Framework gives you the most commonly used namespaces
1.1.3.ASP.NET reserved application folders
1.1.4.Notable ASP.net file extension