Error with partitioned session

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Running ASP.NET2. Every once in a while I get this error:

Unable to cast object of type 'System.Collections.DictionaryEntry' to type
'System.Web.PartitionInfo'.

at System.Web.PartitionManager.Dispose()
at System.Web.SessionState.SqlSessionStateStore.OnAppDomainUnload(Object
unusedObject, EventArgs unusedEventArgs)

I setup a partitioned session db by overriding
System.Web.IPartitionResolver and using a simple hash to return an index in
a list of connection strings.

public String ResolvePartition(Object key)
{
String sid = (String)key;

// hash the incoming session ID into
// one of the available partitions
int partitionID = Math.Abs(sid.GetHashCode()) % partitions.Length;

return partitions[partitionID];
}

I did it based on the article here:
http://msdn.microsoft.com/msdnmag/issues/05/09/SessionState/default.aspx#S8
and just did the sessiondb instead of the session state server. As I said
works fine most of the time but throws the above exception once in a while.
 
Back
Top