Session cookies are working fine in Chrome and Firefox, but with IE9 and AJAX requests, I lose all session cookies.
Direct request to view
public class AddressController : Controller
{
[MvcSiteMapNode(Title = "Addresses", ParentKey = "MyAccount", Key = "Addresses")]
public ActionResult Index()
{
....
var memberId = GetKeyValues.GetMemberId(); // This works perfect.
...
}
Ajax call
$.ajax({
url: "/Address/CheckPrimaryAddressGood?t="+ Math.random(),
type: "Get",
success: function(data) {
...
public class AddressController : Controller
{
public ActionResult CheckPrimaryAddressGood()
{
...
var memberId = GetKeyValues.GetMemberId();
...
}
}
public static class GetKeyValues
{
public static string GetMemberId()
{
if (HttpContext.Current.Session[keyCookie] != null)
{
memberId = GetMemberIdFromSession();
}
else if (HttpContext.Current.Request.Cookies["token"] != null)
{
memberId = GetMemberIdFromCookie();
}
}
}
From AJAX call I lost cookies values only IE9. I tried P3P override still did not work from this post P3P link
Has anyone had a similar issue? Please let me know how to resolve this. I spent already a day on this.
Edit
I just traced in Fiddler IE is not sending Header data it is just sending "Connection=Keep-Alive&Pragma=no-cache&Accept=*%2f*&Accept-Encoding=gzip%2c+deflate&Accept-Language=en-US&Host=ebiz.company.com%3a28712&User-Agent=Mozilla%2f5.0+(compatible%3b+MSIE+9.0%3b+Windows+NT+6.1%3b+WOW64%3b+Trident%2f5.0)&Origin=http%3a%2f%2febiz.spe.org%3a28712}
but Chrome: {Connection=keep-alive&Accept=*%2f*&Accept-Encoding=gzip%2c+deflate%2c+sdch&Accept-Language=en-US%2cen%3bq%3d0.8&Cookie=ASP.NET_SessionId%3d2a4tr1ymierclqsfxyfahqbc%3b+__session%3a0.5654769616667181%3ashowwarning%3dtrue%3b+__session%3a0.5654769616667181%3aBadAddressWarning%3dfalse%3b+ ....
Why?