ASP.Net/Session Cookie/Session Event

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

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>
--%>