C# – asp.net mvc JQuery .load SessionState missing keys

asp.net-mvccjquerynet

Hi I am having an issue where i am trying to use JQuery to populate a div tag using the load function on a asp.net MVC website.

I am calling a partialview through a controller and it works fine when i call it directly in the browser but when i try to call it through jquery i get an exception.

My partial view uses the sessionstate to obtain permissions that a user has so that it can determine how the partial view is generated.

When i call it from the browser the sessionstate works fine, but when i call it from JQuery the session state is missing the key/value pairs that i added to it to store the permissions of the user.

Can anyone explain what I am missing and why this is not working.

My session state mode is currently set to inproc.

Best Answer

Well I eventually found my own answer.

When you load the partial view using the load function in JQuery it acts like a new browser and signs in again without pushing your current session across properly.

In order to get this to work i switched to get $.get() function and the session was there as was expected.