How to redirect to login page automatically, after session time out.

    Question by:
    On

    Topics:

    How to redirect to login page automatically, after session time out?
    In my web application, user logs in in the application, after a certain time (30 mins) session times out and login page appears only AFTER user action.
    I would like to redirect the user back to the login screen automatically (before user performs any action) after session has timed out.

    Your suggestions will be greatly appreciated.
    I used following code in pagerender of masterpage.
    
     
    
     HttpContext.Current.Response.AppendHeader("Refresh", Convert.ToString(((HttpContext.Current.Session.Timeout * 60) - 5)) + "; Url=homepage.aspx")
    
     
    
    Also, i have Session_Start/Session_end in global.asax.
    

    Open in new window

    Good Question?
    0

    Featured Post

    Course: Foundations of Front-End Development

    Jump-start a lucrative career in front-end web development, with zero previous coding experience required. This course covers the basic programming concepts and languages required for creating engaging websites from scratch.

    Top Expert Contributor

    Essential articles and videos from the Experts

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
    This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

    More valuable questions with Expert answers

    Question: Hello, I am using code like With xlWorkSheet.PageSetup .PrintGridlines = True .CenterHeader = StrSheetname .Zoom = False .FitToPagesWide = 1 ...

    Answer: place the autofit after the data is inserted maybe after xlRange.Value = objXlData

    Question: Hello, How to install telerik ribbon bar in vb.net desktop form Cheers

    Answer: you need to download the component from their site and installing it on your system will add it to your toolbox

    Question: Hi Guys, I'm wondering why the method I wrote return the same item. Here is my scenario: First, I'm querying items from the database using linq: (CODE) I'm getting the item just fine no issue, but when I'm looping through the items the...

    Answer: Try like this. (CODE)

    Question: Is there a way to tell Visual Studio to build a project (one project of many within a solution) whenever I run the project?

    Answer: create a batch file that compile your project and add the call to this batch file in the pre-build events of your starting project : https://msdn.microsoft.com/en-us/library/42x5kfw4.aspx

    201601-LO-Qu-076

    Extend your technology team with the Experts Exchange community.

    — trusted by —

    Who answers my questions?Our community has technology experts around the world.

    Éric Moreau

    2

    Articles

    10,600

    Solutions

    Expert in:

    • .NET Programming
    • Visual Basic.NET
    • C#
    • Visual Basic Classic
    • ASP.NET

    it_saige

    1,265

    Solutions

    Expert in:

    • .NET Programming
    • C#
    • Visual Basic.NET
    • ASP.NET
    • Active Directory

    Russ Suter

    455

    Solutions

    Expert in:

    • .NET Programming
    • ASP.NET
    • C#
    • CSS
    • HTML

    Fernando Soto

    5,173

    Solutions

    Expert in:

    • .NET Programming
    • C#
    • Visual Basic.NET
    • ASP.NET
    • Editors IDEs

    AndyAinscow

    11

    Articles

    3,246

    Solutions

    Expert in:

    • .NET Programming
    • C#
    • System Programming
    • Visual C++.NET
    • ASP.NET

    Guy Hengel [angelIII / a3]

    11

    Articles

    37,323

    Solutions

    Expert in:

    • MS SQL Server
    • MS SQL Server 2005
    • Databases-Other
    • MS SQL Server 2008
    • MySQL Server

    esskayb2d

    384

    Solutions

    Expert in:

    • .NET Programming
    • ASP.NET
    • C#
    • Visual Basic.NET

    sarabande

    1,393

    Solutions

    Expert in:

    • C++
    • C
    • Programming-Other
    • Visual C++.NET
    • .NET Programming

    Paweł

    67

    Solutions

    RELATED TOPICS view all topics

    1. ASP.NET
      (122,582)
    2. C#
      (90,581)
    3. Visual Basic.NET
      (91,305)
    4. MS Development-Other
      (47,893)
    5. Editors IDEs
      (24,918)
    6. Visual Basic Classic
      (163,316)
    7. MS SQL Server
      (155,320)
    8. MS SQL Server 2005
      (71,250)
    9. Programming-Other
      (51,581)
    10. JavaScript
      (118,120)