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

  • SEARCH
  • Home
  • 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 370253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:00:00+00:00 2026-05-12T14:00:00+00:00

In my asp.net website i am using asp.net form authentication with following configuration <authentication

  • 0

In my asp.net website i am using asp.net form authentication with following configuration

<authentication mode="Forms">
    <forms loginUrl="~/Pages/Common/Login.aspx"
           defaultUrl="~/Pages/index.aspx"
           protection="All"
           timeout="30"
           name="MyAuthCookie"
           path="/"
           requireSSL="false"
           cookieless="UseDeviceProfile"
           enableCrossAppRedirects="false" >
    </forms>
</authentication>

I have following questions

  1. What should be timeout value for session because i am using sliding expiration inside form authention due to which session will expire before form authentication. How can i protect it?

  2. After formauthentication log out i would like to redirect page at logout.aspx but it is automatically redirect me at loginpage.aspx. How is it possible?

  • 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-12T14:00:00+00:00Added an answer on May 12, 2026 at 2:00 pm
    1. To be on the safe side: TimeOut(Session) <= TimeOut(FormsAuthentication) * 2
    2. If you want to show page other than specified in loginUrl attribute after authentication timeout you need to handle this manually as ASP.NET does not provide a way of doing it.

    To achieve #2 you can manually check the cookie and its AuthenticationTicket for expiration and redirect to your custom page if they have expired.
    You can do in it in one of the events: AcquireRequestState, AuthenticateRequest.

    Sample code in the event can look like:

    // Retrieve AuthenticationCookie
    var cookie = Request.Cookies[FormsAuthentication.FormsCookieName];
    if (cookie == null) return;
    FormsAuthenticationTicket ticket = null;
    try {
        ticket = FormsAuthentication.Decrypt(cookie.Value);
    } catch (Exception decryptError) {
        // Handle properly
    }
    if (ticket == null) return; // Not authorised
    if (ticket.Expiration > DateTime.Now) {
        Response.Redirect("SessionExpiredPage.aspx"); // Or do other stuff here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Forms authentication in ASP.NET MVC website and I store user account login
i am using form authentication for my website which is written in ASP.Net, but
I am using form authentication inmy ASP.NET 2.0 website. Today during testing i was
I am using JQuery mobile in asp.net web form website. I have the following
I have an existing asp.net mvc website that uses basic forms authentication. The site
I have a login form on the home page of an ASP.NET 3.5 website
I created a new ASP.NET website using Visual Web Developer 2008 Express edition and
I'm attempting to build a ASP.NET website using MSBuild - specifically the AspNetCompiler tag.
I have developed an ASP.Net (VB.Net) website which is using Entity Framework and SQL
I am trying to use NServiceBus with an ASP.NET MVC 2 website (using VS

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.