.ASPXANONYMOUS cookie gets rewritten in every new session

I have an ASP.NET 3.5 site written on top of Azure for which I am trying to allow both authenticated and anonymous user profiles. Authenticated profiles work fine. But if I have not logged in, I see that the .ASPXANONYMOUS cookie .ASPXANONYMOUS sent with the profile information in the SetCookie directive. If I then close my browser session and start again, I will immediately put the SetCookie directive from the server, setting the .ASPXANONYMOUS cookie to a new value:

 HTTP/1.1 200 OK Cache-Control: private Content-Type: text/html; charset=utf-8 Server: Microsoft-IIS/7.5 X-AspNet-Version: 2.0.50727 Set-Cookie: .ASPXANONYMOUS=dTJEJCr...; expires=Fri, 12-Mar-2010 21:22:38 GMT; path=/; HttpOnly X-Powered-By: ASP.NET Date: Wed, 10 Feb 2010 21:22:41 GMT Content-Length: 3146 

thus, profile information is lost between sessions. I do not understand why this is happening. I would think that storing the cookie value would be intact. My web.config has the following:

  <!-- We allow anonymous users to have a profile using ASP.Net anonymous profiles --> <anonymousIdentification enabled="true" cookieless="UseDeviceProfile" cookieName=".ASPXANONYMOUS" cookieTimeout="43200" /> 

Any ideas on what I need to do to keep cookies in sessions in order to allow anonymous profiles?

+4
source share
2 answers

I understand that after 9 months the poster probably moved on. I also understand that the answer I am going to provide is more a work than a solution. I also did not develop Azure, and I could be completely out of base; however, the unanswered questions are deceiving me - that’s what I found.

If you use your real IP , not 127.0.0.1, your SessionID is stored in the requests.

+1
source

I can confirm PhillFox comment

When using the ASP.NET_SessionID authentication form, cookie var creates a value in the session so that subsequent requests can persist between postbacks.

I checked everything, the reason this did not happen for me was precisely because I had in mind 127.0.0.1, as soon as I changed it to a valid IP address, the ASP.NET_SessionID and ASPXANONYMOUS cookie were saved.

0
source

Source: https://habr.com/ru/post/1300930/


All Articles