Forms Authenticatin Persistent Cookies RRS feed

  • Question

  • User1999497519 posted

    On my log in page I added a check box option so my users can stay logged in (60 days) even after they close there browser. If the check box is checked then my code behind adds a persistent cookie to the response. 

    Everything works as it should on the localhost but on the server it does not.  It appears ever time the application or application pool is restarted the users of my website have to re log in again. Using Firefox I found the authentication cookie (.ASPXAUTH) with the correct expiration date of 60 days out but still forced to re log in.

    Thank You! 

    Tuesday, July 15, 2014 1:57 PM


All replies

  • User1779161005 posted

    You need to explicitly configure the <machineKey> element in web.config and sync that element's values across all machines in your server farm.

    Tuesday, July 15, 2014 1:59 PM
  • User1999497519 posted

    Can you explain in more detail. Thanks!

    Tuesday, July 15, 2014 5:08 PM
  • User-734925760 posted


    According to your description, I think you should make some break points to debug steps by steps, then to check if you have got the Login data.

    There is an article about this, it suggests creating a  cookie with expiry of 60 days, as we login we should check this cookie value.

    For more information, please refer to the link below:


    Hope it's useful for you.

    Best Regards,

    Michelle Ge

    Wednesday, July 16, 2014 4:19 AM
  • User1999497519 posted

    What am I suppose to put in the <machineKey> element in my web.config file?


    Wednesday, July 16, 2014 9:37 AM
    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 16, 2014 9:47 AM