I've recently inherited an application that makes very heavy use of session, including storing a lot of custom data objects in session. One of my first points of business with this application was to at least move the session data away from InProc, and off load it to either a stateserver or SQL Server.
After I made all of the appropriate data objects serializable, and changed the web.config to use a state service, everything appeared to work fine.
However, I found that this application does a lot of object comparisons using GetHashCode(). Methods that worked fine when the session was InProc no longer work because the HashCodes no longer match when they are supposed to. This appears to be the case when trying to find a specific child object from a parent when you know the child object's original hash code
If I simply change the web.config back to using inproc, it works again.
Anyone have any thoughts on where to begin with this?
EDIT:
qbeuek: thanks for the quick reply. In regards to:
The default implementation of GetHashCode in Object class return a hash value based on objects address in memory or something similar. If some other identity comparison is required, you have to override both Equals and GetHashCode.
I should have given more information on how they are using this. Basically, they have one parent data object, and there are several arrays of child objects. They happen to know the hash code for a particular object they need, so they are looping through a specific array of child objects looking for a hash code that matches. Once a match is found, they then use that object for other work.