Reputation: 29740
I have a default asp.net MVC project and it perfroms a 302[Found] redirect with my auth cookie and then I can see a request to the root for what seems to be no reason. I would have thought all that was needed was a single request but you can see from fiddler I have two which is confusing. Can anyone explain why the second request has to happen is this something I should disable?
Upvotes: 4
Views: 282
Reputation: 57907
In order for you to be logged in, ASP.NET needs to drop a cookie on your machine. To do this, it must send the cookie in the response. In order for that cookie to be used on subsequent requests, it must be sent on the following request.
A 302 redirect provides a nice way for this to happen. The server issues the 302 redirect, sending the cookie to the browser along the way. The browser responds by issuing another request to the redirected resource, which this time includes the cookie required to ensure the user is Authenticated.
Upvotes: 6