ASP.net finally learned the asp.net. There are two years experience in ASP development I always thought that ASP. NET will not be difficult. I chose vb.net to develop ASP.net, because I have learned VB, and the development of ASP is also the use of VBS. It is because of the development experience of VB and VBS, I am full of confidence in ASP.net's study.
Configure the operating environment of ASP.net: A new blank aspx page with DW, press F12, can display normally, this shows that my asp.net running environment has been configured successfully! So, I presume to enter the following code:
<script LANGUAGE=VB runat=server>
Response.Write "My first asp.net program."
</script>
Press F12 with confidence, but the result is "compile error." Looking at the wrong explanation, I could not touch my head. Had to open the tutorial, finally found the answer, so I changed the program to:
<script LANGUAGE=VB runat=server>
Sub Page_Load ()
Response.Write "My first asp.net program."
End Sub
</script>
Once again, the result is F12. The compile error: The method argument must be enclosed in parentheses. "That's it, ASP. NET's syntax is so strict. In the ASP, Response.Write "My first asp.net program" is completely legitimate, absolutely normal operation.
Replace the procedure with the following:
<script LANGUAGE=VB runat=server>
Sub Page_Load ()
Response.Write ("My first asp.net program")
End Sub
</script>
Finally, OK! At this time I do not have the joy of success, but I feel sad ...
My favorite is to use for ... NEXT, so I changed the program to:
<script LANGUAGE=VB runat=server>
Sub Page_Load ()
For I=1 to 100
Total=total+i
Next
Response.Write (Total)
End Sub
</script>
Looking forward to output 5050, the result is error----"I" undefined. Cold, the original is no longer like the VBS in the ASP, do not need to declare the variable explicitly, but to display the declaration variable. Had to change the procedure to read:
<script LANGUAGE=VB runat=server>
Sub Page_Load ()
Dim i,total As Integer
For I=1 to 100
Total=total+i
Next
Response.Write (Total)
End Sub
</script>
The lovely 5050 finally came out ~ ~ ~ ~ ~
The purpose of my writing this post is to tell my friends who are ready to learn asp.net, and pay attention to the standardization of the Code! In particular, C # friends, but also pay attention to a case sensitive problem. At the same time, XML has a very strict syntax rules, such as, in HTML <br> is legal, but in XML, must add a terminator, that is, <br/>.