开发者

Access to session when making ajax call to Asp.net MVC action

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 m开发者_开发技巧y session keys populated. How can i have access to my session keys when i make a call using ajax.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜