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 4079574
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:49:10+00:00 2026-05-20T17:49:10+00:00

I am using the ASP.NET login control. I want to be able to set

  • 0

I am using the ASP.NET login control. I want to be able to set the timeout for Forms Authentication individually for each user (instead of globally in the web.config). From what I understand the only way to do this is to set the timeout on the AuthenticationTicket manually. Is there a way to do this when using the Login Control? It seems to me that the Login Control abstracts away all of this. I am hoping that there is some way to continue using the Login Control, but also have the ability to set the FormsAuthentication timeout individually for each user.

Thanks,
Corey

  • 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-20T17:49:11+00:00Added an answer on May 20, 2026 at 5:49 pm

    MSDN says:

    The LoggedIn event is raised after the
    authentication provider checks the
    user’s credentials and the
    authentication cookie is queued to
    send to the browser in the next
    response. Use the LoggedIn event to
    provide additional processing, such as
    accessing per-user data, after the
    user is authenticated.

    So this event seems to be the right place to replace cookies. Firstly, the cookie need to be retrieved and decrypted:

    HttpCookie authCookie = Response.Cookies[FormsAuthentication.FormsCookieName];
    FormsAuthenticationTicket oldAuthTicket = 
        FormsAuthentication.Decrypt(authCookie.Value);
    

    right after this, the new authentication ticket based on just extracted should be created:

    FormsAuthenticationTicket newAuthTicket = new FormsAuthenticationTicket(
        oldAuthTicket.Version,
        oldAuthTicket.Name,
        DateTime.Now,
        DateTime.Now.Add(timeoutForUser),
        oldAuthTicket.IsPersistent,
        oldAuthTicket.UserData,
        FormsAuthentication.FormsCookiePath
    );
    

    timeoutForUser here is a TimeSpan value that holds the session timeout for the user.

    And finally, the old cookie in the response should be replaced with the new one:

    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
    authCookie = 
        new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
    HttpContext.Current.Response.Cookies.Set(authCookie);
    

    This should do the trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the asp.net login control for user authentication. I also have the userID
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET
I'm using the ASP.Net Login control to login a web application. When the user
I am using a asp.net login control with one of my asp.net application to
Help! I'm using the ASP.Net Login control on a Login page, but the Login
I am verifying my login authentication using ASP.net webservices. But the client requested to
I want to make a login system using ASP.NET (MVC). On the internet, I
Using the standard ASP.NET login control, I'm trying to get it to deny me
I am using a login control where user enters the username and passwords.I want

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.