ASP.Net/Session Cookie/Timeout

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

Get current session timeout value (VB.net)

<%@ Page Language="vb" %>
<html>
   <head>
      <script runat="server">
         Sub Page_Load()
            Message.Text = "Current Session timeout value is " & _
               Session.Timeout & " minutes."
         End Sub
      </script>
   </head>
<body>
   <asp:label id="Message" runat="server"/>
</body>
</html>



Session TimeOut (VB.net)

<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
    Session.TimeOut = 2
    lblMessage.Text = "Without activity, your session " _
        & "will expire in " & Session.TimeOut _
        & " minutes.<BR>"
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>