Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4070532
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:38:22+00:00 2026-05-20T16:38:22+00:00

What should I write in web config file in asp.net so that my session

  • 0

What should I write in web config file in asp.net so that my session time is extended. and please tell me the exact location where should I place the code in web config

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:38:22+00:00Added an answer on May 20, 2026 at 4:38 pm

    If you are trying to stop the session from timeing out all the time you can do this rather than increasing the session timeout.

    KeepAlive.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="KeepAlive.aspx.cs" Inherits="Pages.KeepAlive" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <%@ OutputCache Location="None" VaryByParam="None" %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        KEEP ALIVE
        </div>
        </form>
    </body>
    </html>
    

    Keep Alive.aspx.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    namespace Pages
    {
        /// <summary>
        /// Page to keep the session alive
        /// </summary>
        public partial class KeepAlive : System.Web.UI.Page
        {
            //- EVENTS ------------------------------------------------------------------------------------------------------------------
    
            #region Events
    
            /// <summary>
            /// Page Load
            /// </summary>
            /// <param name="sender">object</param>
            /// <param name="e">args</param>
            protected void Page_Load(object sender, EventArgs e)
            {
                try
                {
                    //Add refresh header to refresh the page 60 seconds before session timeout
                    Response.AddHeader("Refresh", Convert.ToString((Session.Timeout * 60) - 60));
                }
                catch (Exception)
                {
                    throw;
                }
            }
    
            #endregion Events
    
            //---------------------------------------------------------------------------------------------------------------------------
        }
    }
    

    Then in your master page create an iFrame that refreshes to keep the session alive

    <iframe id="Defib" src="KeepAlive.aspx" frameborder="0" width="0" height="0" runat="server">
    </iframe>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need write a regular expression for RegularExpressionValidator ASP.NET Web Controls. The regular expression
Should log classes open/close a log file stream on each write to the log
I want to write a small program that should print something like testing CPU...
I'm working on a web site where the new pages are ASP.NET and the
How should I properly restart the ASP.NET (IIS 5.1) server in order to refresh
Is there any use for FormsAuthentication.Authenticate() is real-world web applications? Why should we write
In a multilayer application (ASP MVC: UI project, DAL project) i registered in web.config
I have made connection string in web.config file. <connectionStrings> <add name=Test_registration connectionString=Data Source=DOTNET\SA;Initial Catalog=Test2009;User
I'm in the process of building a web application in ASP.NET MVC C# (including
Question: Should I write my application to directly access a database Image Repository or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.