what is ASPXAUTH cookie?

asp.netCookiesForms Authentication

asp.net Problem Overview


While working with ASP.Net Forms Authentication I came across the .ASPXAUTH cookie. I have a couple questions:

  • What is the purpose of this cookie?
  • What is the location of this cookie?

asp.net Solutions


Solution 1 - asp.net

The ASPXAUTH cookie is used to determine if a user is authenticated.

As far as the location of the cookie, that depends on your browser. If you are using Firefox you can view the cookie by clicking on Tools -> Options -> Privacy. Then scroll down to the domain and expand it to see the cookie and its value. The value is encrypted using the machine key (located in the server's machine.config or web.config file) so looking at the cookie on the client won't really provide you any information. You can decrypt/view the value on the server side using:

HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];//.ASPXAUTH
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);

where authTicket has these fields:

enter image description here

The statement "ASPXAUTH is basically used to maintain ASP.NET Session State" is incorrect. ASP.NET issues an entirely different cookie, named ASP.NET_SessionId, to track session state.

Solution 2 - asp.net

Actually the .ASPXAUTH cookie does not accurately tell you when the user is truly authenticated. When the user logs out of the app, the .ASPXAUTH cookie is removed from the browser. However, if you go back to the site within a short period of time (with timeout of form auth cookie), and edit the new ASP.NET_SessionId cookie's with the following:

  • change "name" field from "ASP.NET_SessionId" to ".ASPXAUTH"
  • change "value" from 24 char sessionID to old 448 char authentication string

After refresh you will be able to assume the identity of the authenticated user without technically re-authenticating again. (again assuming you do this within the specificied timeout stored within the .ASPXAUTH encrypted auth string)

A good blog post explains the problem in more detail. A possible solution is to couple the .ASPXAUTH with the ASP session.

Solution 3 - asp.net

If a user's interactions with the HTML login URL have allowed the TSWPPserver to establish the user’s identity, the remote server SHOULD generate a cookie that identifies the user and allows authentication to the server. The contents of the cookie SHOULD be signed and encrypted. The specific implementation of this cookie including the signing and encryption algorithms is dependent on the implementation of the TSWPP server, because only the server is required to parse the contents of the cookie. If the server implements the cookie, then the cookie MUST be returned in an HTTP payload with a Content-Type of "application/x-msts-webfeed-login".

http://msdn.microsoft.com/en-us/library/ee920427.aspx

Solution 4 - asp.net

on Chrome Browser 1.developer tools -F12 2.locate Application tab 3.point the left pane for cookies you will find it out if ASPXAUTH cookie for the available session on logged in applicaion

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbalaweblogView Question on Stackoverflow
Solution 1 - asp.netToddView Answer on Stackoverflow
Solution 2 - asp.netRobertView Answer on Stackoverflow
Solution 3 - asp.netCruiser KIDView Answer on Stackoverflow
Solution 4 - asp.netuser8876159View Answer on Stackoverflow