ASP.Net/Session Cookie/Session Event — различия между версиями

Материал из .Net Framework эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 11:53, 26 мая 2010

Global session events (VB.net)

<%--
 Save this to  global.asax
 
<object id="myTB" class="System.Web.UI.WebControls.TextBox" scope="session" runat="server"/>
<object id="myTB2" class="System.Web.UI.WebControls.TextBox" scope="session" runat="server"/>
<object id="myLBL" class="System.Web.UI.WebControls.Label" scope="session" runat="server"/>
<Script language="VB" runat="server">
   Sub Session_OnStart()
      Dim EventLog1 As New System.Diagnostics.EventLog ("Application", ".", "mySource")
      EventLog1.WriteEntry("Session_OnStart fired!")
      Context.Response.AppendToLog("Session_OnStart fired!")
   End Sub
   Sub Session_OnEnd()
      Dim EventLog1 As New System.Diagnostics.EventLog ("Application", ".", "mySource")
      EventLog1.WriteEntry("Session_OnEnd fired!")
   End Sub
   Sub Application_OnError()
      Dim EventLog1 As New System.Diagnostics.EventLog ("Application", ".", "mySource")
      EventLog1.WriteEntry("Error Occurred. Error info:" & Server.GetLastError().ToString())
   End Sub
</script>
--%>