asp.net-mvcrazorcookiescookieless

Url.Content Cookieless Parameter Missing


I have two different MVC applications. They are both using cookieless session states and both use this line to determine the application's root:

var root = '@Url.Content("~/")';

For some reason one application recognizes the cookieless parameter and provides a proper root url containing the cookie parameter (Something like: /(S(03lyoc2mzcq5cyqqqzgritk2))/). The other application just has the root url as /.

I have found a work around for the application that only provides /:

var root = '@Url.Action("Index", "Home")';

The application that properly provides the cookieless parameter combines both webforms and MVC. Any ideas on where my inconsistency might be?


Solution

  • After some research and testing it was the version of MVC that made the difference. It appears that in MVC 4, the cookie parameter will be included, however, in MVC 5 the cookie is no longer added to the url.

    If someone has a more detailed answer as to why this feature was removed I'd be happy to accept it as the answer. I have a feeling it's because Microsoft isn't wanting to support cookieless anymore, but I have no proof to support that. This may be a clue... https://stackoverflow.com/a/21652454/386856