For some reason, after 2 or 3 calls, my cookie no longer passes. Usually after 3 requests my cookie disappears from the request. I have no idea why. I do not make any cross domain calls. I noticed in one of the answers that the ASPXAUTH cookie returns to the Cookies Response (browsing in Google Chrome, the network inspector) and is empty. The Expire column indicates "Session". Thus, it seems that my cookie is getting back empty, and therefore authentication fails. I just donโt know why it works for 2 calls and then comes back. I'm tired of the fact that the cookies do not expire, but it did not work. The answer back from the server is to call the MVC to return a partial view.
Normal query:
Accept:application/json, text/javascript, */*; q=0.01 Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Content-Length:271 Content-Type:application/json; charset=UTF-8 Cookie:.ASPXAUTH=7B8EFA9A1F81CE1D400A054827A34719FF7E00161FA065A9637DF42A6F46CE2ECDA40216B88ADCADC0DBA712109BCDCD1A0E712019556C72CA76B52041057C480C6C8274CF0BCEA9DE4891457218B52EB96177754064DC24B0FEC1A0BF51364B16294CED53BAD0CEFC37AA70B92CF29407A307548135C4B7D35060BAE3DDE7031332049B67A62D108F84C1167552D73842B5D4CB83706A6B5787F019184371A8050364F8DFA83F7F1F8AE5A7CF8AB341F25D01E9761C735803D8AAFC97488FF3C7E0B272BCDB669B5E7E17C964402FC9B5E9514A1C105E172D09AB36077C961D5B1079AF6B10B17199AC3320BAC7F0A4A9C28987992D71385531A1E78B18AF7B Host:localhost:3182 Origin:http://localhost:3182 Referer:http://localhost:3182/Admin/UserAdmin/Profile/e82228b1-abbb-4ecf-a259-12b66f5f07ba User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11 X-Requested-With:XMLHttpRequest
Request after cookie disappears:
Accept:application/json, text/javascript, */*; q=0.01 Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Content-Length:274 Content-Type:application/json; charset=UTF-8 Host:localhost:3182 Origin:http://localhost:3182 Referer:http://localhost:3182/Admin/UserAdmin/Profile/e82228b1-abbb-4ecf-a259-12b66f5f07ba User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11 X-Requested-With:XMLHttpRequest
UPDATE After I struggled with this problem for a while, I decided not to use authentication in formats and roll back my own. I will be posting my decision on GIT in the coming days. From what I could see, something funky comes up with an answer after an Ajax request and forms authentication. For some reason, an empty cookie is sent back even if it is valid until the actual response is generated.
source share