Saturday, January 11, 2014

ASP.NET Session Timeout Control + jQuery Dialog

  <sessionState mode="InProc" stateConnectionString="tcpip=" sqlConnectionString="data source=;Trusted_Connection=yes" cookieless="false" timeout="2"/>

  <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="ASPNET_jQueryUI_Dialog_Timeout.Site1" %>
<%@ Register Assembly="TSC.Timeout" Namespace="TSC.Timeout" TagPrefix="tsc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="" >
<head runat="server">
    <asp:ContentPlaceHolder ID="head" runat="server">
<body style="font-size: 75%;">
    <script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="scripts/jquery-ui-1.7.0.min.js"></script>
    <script type="text/javascript" src="scripts/jquery.bgiframe-2.1.1.pack.js"></script>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
        <tsc:Timeout ID="Timeout1" runat="server" title="Session Expiring" Enabled="true" TimeoutURL="~/TimeOut.aspx" DisplayButton="false">
                    <span class="ui-icon ui-icon-alert" style="float:left; margin: 1px 10px 20px 0;"></span>
                    Your session is about to Expire.
                <br style="font-size:x-small;" />
                <p>Click <b>OK</b> to continue your session.</p>                  
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ASPNET_jQueryUI_Dialog_Timeout
    public partial class Site1 : System.Web.UI.MasterPage
        public bool TimeoutControlEnabled
            get { return Timeout1.Enabled; }
            set { Timeout1.Enabled = value; }
        protected void Page_Load(object sender, EventArgs e)
            Timeout1.TimeoutMinutes = HttpContext.Current.Session.Timeout;
            Timeout1.AboutToTimeoutMinutes = HttpContext.Current.Session.Timeout - 1;



Pavithra M said...

The Session object stores information about, or change settings for a user session.perfect explanation about session in asp. Dot Net Training in chennai | Dot Net Training in velachery

Mithun Mithun said...

Given so much information in it. its very useful .perfect explanation about Dot net framework.Thanks for your valuable information. dot net training in velachery | dot net training in chennai

Post a Comment