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

The Archive Base Latest Questions

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

I am still a bit confused about something about FormsAuthenticationTicket and the actual cookie

  • 0

I am still a bit confused about something about FormsAuthenticationTicket and the actual cookie container.

  1. What does DateExpiration in FormsAuthenticationTicket() refer to? Is that when the cookie dies? Is that how long the user can stay logged in without any active actions (i.e. timeout)?

  2. <forms loginUrl="~/Account/LogOn"
           protection="All"
           timeout="20160"
           name="test"
           path="/"
           requireSSL="false"
           slidingExpiration="false"
           defaultUrl="default.aspx"
           cookieless="UseDeviceProfile"
           enableCrossAppRedirects="false" />
    

    This is what is in my web config. Now, do any of these get set to the cookie automatically? For instance, can I grab from the name field what I need to grab when making my cookie?

     HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
    

    But what about setting protection (whatever that is), timeout, slidingExpiration, enableCrossAppRedirects, cookieless etc.? I don’t see properties to set these. Are they automatically taken from the webconfig or what?

  3. What is the difference between DateExpiration set in the FormsAuthTicket and the one you set for the cookie (authCookie.Expires)?

Thanks

  • 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:47:25+00:00Added an answer on May 12, 2026 at 2:47 pm
    1. FormsAuthenticationTicket.Expiration is the time at which the ticket expires. The ticket expiry date/time is stored in the encrypted ticket, so is independent of the cookie expiration time. Note that the client can see and tamper with the cookie expiration time, but should not be able to tamper with the encrypted ticket.

    It controls how long the user can access the site without reauthenticating.

    1. The values from web.config are used to build the ticket. You can also build your own ticket with any values you want, encrypt it, and store it in a cookie. There is an example of this in the MSDN documentation for the FormsAuthenticationTicket class.

    UPDATE

    This MSDN article has info on this subject. If protection is set to All in your web.config, then the ticket is encrypted using the algorithm specified on the machineKey element. The default is SHA1 and AES according to this article.

    If you want to see an unencrypted ticket you can set protection=”None” in your web.config, though you wouldn’t normally want to do this in a production app.

    You can also use a tool such as Lutz Reflector to examine the source of the FormsAuthentication and FormsAuthenticationTicket classes to understand more about how the ticket is generated.

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

Sidebar

Ask A Question

Stats

  • Questions 259k
  • Answers 259k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Even Uncle Bob Martin, a staunch defender of TDD and… May 13, 2026 at 11:15 am
  • Editorial Team
    Editorial Team added an answer echo strtotime('2010-03-01'); An alternative is to use DateTime(): // PHP… May 13, 2026 at 11:15 am
  • Editorial Team
    Editorial Team added an answer Storing it in the session scope is the easiest way… May 13, 2026 at 11:15 am

Related Questions

I am bit confused about the difference between the usage of std::remove algorithm. Specifically
I am a somewhat experienced Rails developer and I thought I would try out
I am a little bit confused about 2 things. Firstly when I create an
Important: This question is getting quite long, if this is the first time you're

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.