views:

206

answers:

2

Hi, i have a controller action being called using an ajax request, but when i tried to access session (HttpContext.Session["key"]), i dont have any of my session keys populated. How can i have access to my session keys when i make a call using ajax.

A: 

The available Session in the controller is the HttpSessionStateBase. You can access it using either Session[param] or base.Session[param] if your controller inherits from Controller. But this may be useless with Ajax if you have it set cookieless.

Yuriy Faktorovich
A: 

It's difficult to figure out why your session is not getting populated for Ajax calls. I can only tell you that your session should get populated for Ajax calls.

Jaco Pretorius