ASP.Net/Session Cookie/New Session

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

Session.IsNewSession (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
    Session.TimeOut = 2
    If Session.IsNewSession Then
        lblMessage.Text = lblMessage.Text _
        & "The request made to this page spawned a " _
        & "new session.<BR>"
    Else
        lblMessage.Text = lblMessage.Text _
        & "The request made to this page did not " _
        & "spawn a new session.<BR>"
    End if
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Session Properties</TITLE>
</HEAD>
<form runat="server">
<asp:label 
    id="lblMessage" 
    font-size="12pt"
    font-name="Tahoma"
    runat="server"
/>
</form>
</BODY>
</HTML>