Asp.net| program by learning the first few sections of the concept of headache and hard installation configuration work, we already have the development of asp.net procedures of the initial knowledge and operating platform, then, let us begin to enter the ASP.net world, feel asp.net wonderful bar.
We use the most rudimentary development tool-Notepad, to suggest the first asp.net page, add the following code in Notepad:
<%@ Page language= "VB"%>
<title>my-asp.net pages!</title>
<body>
</body>
<script language= "VB" runat= "Server" >
Private Sub Page_Load (sender as System.Object, ByVal e as System.EventArgs)
Response.Write ("Hello asp.net! This is my asp.net pages! ")
End Sub
</script>
In the above code, the <%@ Page language= "VB"%> tells the Web server that the program is written in the Visual Basic.NET language, and you can write it using the C # language, of course. Where the logical snippet is all in <Script></Script>, runat= "Server" indicates that the code is to be compiled on the server side, and that the firing event of the code execution is Page_Load, that is, when the page is loaded into memory, The result of running the program is to display a sentence on the page: Hello asp.net! This is my asp.net pages!. For VB 6.0 programmer, this piece of code is again familiar with. In future chapters, this book will detail the ASP.net programming rules and the Visual Basic.NET language usage rules.
Save the code as a hello.aspx file and store it in the root directory of IIS (the system defaults to C:\Inetpub\wwwroot). Then enter in the IE Address: http://localhost/Hello.aspx, get the preview effect as shown in Figure 1.22.
Figure 1.22 hello.aspx Run Results