I want to access a Session variable in ASP.NET MVC, but using a JavaScript variable as a key.
Here is an example in the success bloc of an ajax call :
success: function (data) {
$.each(data, function (idx, user) {
var sessionUserId = '@Session[" ' + user.Id + ' "]'; //this doesn't seem to work
}
Any help would be appreciated.
Thanks.
@Sessionis server side code. Javascript is client side code.