今天写了第一个ASP.NET程序

照葫芦画瓢,写了一个ASP.NET的程序,取名叫frist.aspx吧,权当我的第一个ASP.NET的程序吧。全部程序如下:

<Script Language="vb" Runat="Server">
  Sub myButton_Click(sender As Object, e As EventArgs)
    myLabel.Text = "非常高兴,恭喜您" & myTextBox.Text & ",您的第一个ASP.NET的程序运行完全正
常"
  End Sub
</Script>

<Html>
    <Body>

        <Form Runat = "Server">
           请输入您的姓名:
         <ASP:TextBox Runat = "server" Id="myTextBox"/>
         <ASP:Button Runat = "Server" Id="myButton" Text="确定" OnClick="myButton_Click"/>
        <br><br>
        <ASP:Label Runat = "Server" Id="myLabel"/>
        </Form>
    </Body>
</Html>

这个程序运行非常成功,哈哈,有点开心,但是想想,他的运行原理是什么?看看他的编译源:

行 1:    '------------------------------------------------------------------------------
行 2:    ' <autogenerated>
行 3:    '     This code was generated by a tool.
行 4:    '     Runtime Version: 1.1.4322.573
行 5:    '
行 6:    '     Changes to this file may cause incorrect behavior and will be lost if
行 7:    '     the code is regenerated.
行 8:    ' </autogenerated>
行 9:    '------------------------------------------------------------------------------
行 10:  
行 11:   Option Strict Off
行 12:   Option Explicit On
行 13:  
行 14:   Imports Microsoft.VisualBasic
行 15:   Imports System
行 16:   Imports System.Collections
行 17:   Imports System.Collections.Specialized
行 18:   Imports System.Configuration
行 19:   Imports System.Text
行 20:   Imports System.Text.RegularExpressions
行 21:   Imports System.Web
行 22:   Imports System.Web.Caching
行 23:   Imports System.Web.Security
行 24:   Imports System.Web.SessionState
行 25:   Imports System.Web.UI
行 26:   Imports System.Web.UI.HtmlControls
行 27:   Imports System.Web.UI.WebControls
行 28:  
行 29:   Namespace ASP
行 30:      
行 31:       Public Class frist_aspx
行 32:           Inherits System.Web.UI.Page
行 33:           Implements System.Web.SessionState.IRequiresSessionState
行 34:          
行 35:           Private Shared __autoHandlers As Integer
行 36:          
行 37:          
行 38:           #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",12)
行 39:           Protected myTextBox As System.Web.UI.WebControls.TextBox
行 40:          
行 41:           #End ExternalSource
行 42:          
行 43:          
行 44:           #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",13)
行 45:           Protected myButton As System.Web.UI.WebControls.Button
行 46:          
行 47:           #End ExternalSource
行 48:          
行 49:          
行 50:           #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",15)
行 51:           Protected myLabel As System.Web.UI.WebControls.Label
行 52:          
行 53:           #End ExternalSource
行 54:          
行 55:          
行 56:           #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 57:           Private __control2 As System.Web.UI.HtmlControls.HtmlForm
行 58:          
行 59:           #End ExternalSource
行 60:          
行 61:           Private Shared __initialized As Boolean = false
行 62:          
行 63:           Private Shared __fileDependencies As System.Collections.ArrayList
行 64:          
行 65:          
行 66:           #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",1)
行 67:          
行 68:     Sub myButton_Click(sender As Object, e As EventArgs)
行 69:       myLabel.Text = "非常高兴,恭喜您" & myTextBox.Text & ",您的第一个ASP.NET的程序运行完全正常"
行 70:     End Sub
行 71:  
行 72:           #End ExternalSource
行 73:          
行 74:           Public Sub New()
行 75:               MyBase.New
行 76:               Dim dependencies As System.Collections.ArrayList
行 77:               If (ASP.frist_aspx.__initialized = false) Then
行 78:                   dependencies = New System.Collections.ArrayList
行 79:                   dependencies.Add("D:/works/study/学习ASP.NET/frist.aspx")
行 80:                   ASP.frist_aspx.__fileDependencies = dependencies
行 81:                   ASP.frist_aspx.__initialized = true
行 82:               End If
行 83:           End Sub
行 84:          
行 85:           Protected Overrides Property AutoHandlers As Integer
行 86:               Get
行 87:                   Return ASP.frist_aspx.__autoHandlers
行 88:               End Get
行 89:               Set
行 90:                   ASP.frist_aspx.__autoHandlers = value
行 91:               End Set
行 92:           End Property
行 93:          
行 94:           Protected ReadOnly Property ApplicationInstance As System.Web.HttpApplication
行 95:               Get
行 96:                   Return CType(Me.Context.ApplicationInstance,System.Web.HttpApplication)
行 97:               End Get
行 98:           End Property
行 99:          
行 100:          Public Overrides ReadOnly Property TemplateSourceDirectory As String
行 101:              Get
行 102:                  Return "/study"
行 103:              End Get
行 104:          End Property
行 105:         
行 106:          Private Function __BuildControlmyTextBox() As System.Web.UI.Control
行 107:              Dim __ctrl As System.Web.UI.WebControls.TextBox
行 108:             
行 109:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",12)
行 110:              __ctrl = New System.Web.UI.WebControls.TextBox
行 111:             
行 112:              #End ExternalSource
行 113:              Me.myTextBox = __ctrl
行 114:             
行 115:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",12)
行 116:              __ctrl.ID = "myTextBox"
行 117:             
行 118:              #End ExternalSource
行 119:              Return __ctrl
行 120:          End Function
行 121:         
行 122:          Private Function __BuildControlmyButton() As System.Web.UI.Control
行 123:              Dim __ctrl As System.Web.UI.WebControls.Button
行 124:             
行 125:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",13)
行 126:              __ctrl = New System.Web.UI.WebControls.Button
行 127:             
行 128:              #End ExternalSource
行 129:              Me.myButton = __ctrl
行 130:             
行 131:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",13)
行 132:              __ctrl.ID = "myButton"
行 133:             
行 134:              #End ExternalSource
行 135:             
行 136:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",13)
行 137:              __ctrl.Text = "确定"
行 138:             
行 139:              #End ExternalSource
行 140:             
行 141:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",13)
行 142:              AddHandler __ctrl.Click, AddressOf Me.myButton_Click
行 143:             
行 144:              #End ExternalSource
行 145:              Return __ctrl
行 146:          End Function
行 147:         
行 148:          Private Function __BuildControlmyLabel() As System.Web.UI.Control
行 149:              Dim __ctrl As System.Web.UI.WebControls.Label
行 150:             
行 151:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",15)
行 152:              __ctrl = New System.Web.UI.WebControls.Label
行 153:             
行 154:              #End ExternalSource
行 155:              Me.myLabel = __ctrl
行 156:             
行 157:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",15)
行 158:              __ctrl.ID = "myLabel"
行 159:             
行 160:              #End ExternalSource
行 161:              Return __ctrl
行 162:          End Function
行 163:         
行 164:          Private Function __BuildControl__control2() As System.Web.UI.Control
行 165:              Dim __ctrl As System.Web.UI.HtmlControls.HtmlForm
行 166:             
行 167:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 168:              __ctrl = New System.Web.UI.HtmlControls.HtmlForm
行 169:             
行 170:              #End ExternalSource
行 171:              Me.__control2 = __ctrl
行 172:              Dim __parser As System.Web.UI.IParserAccessor = CType(__ctrl,System.Web.UI.IParserAccessor)
行 173:             
行 174:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 175:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"           请输入您的姓名:"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"         "))
行 176:             
行 177:              #End ExternalSource
行 178:             
行 179:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 180:              Me.__BuildControlmyTextBox
行 181:             
行 182:              #End ExternalSource
行 183:             
行 184:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 185:              __parser.AddParsedSubObject(Me.myTextBox)
行 186:             
行 187:              #End ExternalSource
行 188:             
行 189:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 190:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"         "))
行 191:             
行 192:              #End ExternalSource
行 193:             
行 194:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 195:              Me.__BuildControlmyButton
行 196:             
行 197:              #End ExternalSource
行 198:             
行 199:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 200:              __parser.AddParsedSubObject(Me.myButton)
行 201:             
行 202:              #End ExternalSource
行 203:             
行 204:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 205:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"        <br><br>"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"        "))
行 206:             
行 207:              #End ExternalSource
行 208:             
行 209:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 210:              Me.__BuildControlmyLabel
行 211:             
行 212:              #End ExternalSource
行 213:             
行 214:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 215:              __parser.AddParsedSubObject(Me.myLabel)
行 216:             
行 217:              #End ExternalSource
行 218:             
行 219:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",10)
行 220:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"        "))
行 221:             
行 222:              #End ExternalSource
行 223:              Return __ctrl
行 224:          End Function
行 225:         
行 226:          Private Sub __BuildControlTree(ByVal __ctrl As System.Web.UI.Control)
行 227:              Dim __parser As System.Web.UI.IParserAccessor = CType(__ctrl,System.Web.UI.IParserAccessor)
行 228:             
行 229:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",1)
行 230:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"<html>"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"    <Body>"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"        "))
行 231:             
行 232:              #End ExternalSource
行 233:             
行 234:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",1)
行 235:              Me.__BuildControl__control2
行 236:             
行 237:              #End ExternalSource
行 238:             
行 239:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",1)
行 240:              __parser.AddParsedSubObject(Me.__control2)
行 241:             
行 242:              #End ExternalSource
行 243:             
行 244:              #ExternalSource("D:/works/study/学习ASP.NET/frist.aspx",1)
行 245:              __parser.AddParsedSubObject(New System.Web.UI.LiteralControl(""&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"    </Body>"&Microsoft.VisualBasic.ChrW(13)&Microsoft.VisualBasic.ChrW(10)&"</Html>"))
行 246:             
行 247:              #End ExternalSource
行 248:          End Sub
行 249:         
行 250:          Protected Overrides Sub FrameworkInitialize()
行 251:              Me.__BuildControlTree(Me)
行 252:              Me.FileDependencies = ASP.frist_aspx.__fileDependencies
行 253:              Me.EnableViewStateMac = true
行 254:              Me.Request.ValidateInput
行 255:          End Sub
行 256:         
行 257:          Public Overrides Function GetTypeHashCode() As Integer
行 258:              Return -1376466665
行 259:          End Function
行 260:      End Class
行 261:  End Namespace
行 262: 

有点头晕,但是似乎有些理解它的运行机理了。

继续研究中...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值