ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources] - نسخه متنی

G. andrew Duthie; matthew Macdonald

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید








13.5 Events Reference


Start

Sub Application_OnStart( )
''Event handler logic
End Sub

Fired when the Application is created. The
event handler for this event should be defined in the

global.asax application file.

Parameters


None.

Example


The example writes an entry to both the Application Event log and the
IIS log for the application to indicate that the Start event has
fired:

<Script language="VB" runat="server">
Sub Application_OnStart( )
Dim EventLog1 As New System.Diagnostics.EventLog ("Application", _
".", "mySource")
EventLog1.WriteEntry("Application_OnStart fired!")
Context.Response.AppendToLog("Application_OnStart fired!")
End Sub
</script>

There is one issue with the code above. Security in the released
version of the .NET framework has been tightened, so writing to the
event log will not work by default in an ASP.NET application.

Notes


The Start event is useful for performing initialization tasks when
the application is initialized. You can initialize Application
variables that are mostly static.

End

Sub Application_OnEnd( )
''Event handler logic
End Sub

Fired when the application is torn down,
either when the web server is stopped or when the

global.asax file is modified. The event handler
for this event should be defined in the

global.asax application file.

Parameters


None.

Example


The example below writes an entry to the Application Event log to
indicate that the End event has fired:

<Script language="VB" runat="server">
Sub Application_OnEnd( )
Dim EventLog1 As New System.Diagnostics.EventLog ("Application", _
".", "mySource")
EventLog1.WriteEntry("Application_OnEnd fired!")
End Sub
</script>

Notes


The End event is useful for performing cleanup tasks when the
Application ends, either because the web service stops or the

global.asax file is changed.

/ 873