Hi, I'm writing an ASP.Net MVC application using Jquery to post some data to my users session.
A user 1st accesses my site's page and then I have a button which performs a post using JQuery to an MVC controller method to store some data into the users session.
When the initial page loads I create a session object for my user using a session factory. This works fine. As part of the initial request to my page I put an object called JoinState into my session - this must be in place for any subsequent requests.
When the user clicks the button on the page, a JQuery post is performed to add data to the JoinState object. This posts to an MVC controller method which accesses the already defined session and updates the JoinState object with the posted data.
However, when the post takes places, my application does not recognise the initial session that was created. This leads to an "Object not set to an instance...." (basically a null reference exception) as the already defined JoinState object now does not exist.
I just cannot work out why this is happening. What I have worked out so far is as follows:
- It only affects users who are accessing the site from outside my network.
- Users inside my network are not affected.
- The url name is a dynamic dns name - could this affect how .net sees the session?
- I've used firebug to debug the POST request and can confirm that the ASP.Net session cookie is being sent.
For some reason, in my JQuery post my original session is not recognised.
Thanks in advance.