2

I'm building a web application in ASP.Net 4.0 which must maintain an in-memory state shared between users (better to say between group of user). It is not a standard application and the state related to a group of users are/can/should be persisted only after a group of actions are completed (which can take half an hour). This requirement can't be changed.

As far as i know I can't rely in an in-proc memory because a recycle will clear my state. The only solution I found is to create a standard application (or a windows service), monitored, accessible via NamedPipe, which will store all the information. (For reliability, I will also implement a custom recycle in which the first process is terminated only when all the groups of users have completed their actions).

do you know any simpler way, or a library that could help to manage the state of this applciation ? Do you have any suggestion for this design considering I expect high level of concurrent access to the state ?

Thanks.

SkyG
  • 275
  • 3
  • 11

1 Answers1

0

Store the session data in a database and use a common key for the users that need to share the data.

But, you said you can't use a database and it has to be in memory. My first thought after that was to do something like what you described (with a standalone application on the server that the web application makes calls to). You may also be able to accomplish your objective by leveraging the Cache, but I'm not 100% sure about this. http://msdn.microsoft.com/en-us/library/ms972379.aspx - Caching article

Oh, idea! Create a temporary XML file on the server to track each of these multiuser sessions, and load/parse at each request. But still, this isn't in memory, so maybe that's no good.

The HttpApplication lifecycle does not span to multiple users. I am not a little confused about the HttpApplicationState object:

[This article] (http://msdn.microsoft.com/en-us/library/ms972109.aspx) says it spans to every user of the application. It is basically a dictionary.

I also think you might benefit from reviewing the ASP.NET Application life cycle. The article I use for reference is http://msdn.microsoft.com/en-us/library/ms178473.aspx . Good luck, and let us know what you end up doing

smartcaveman
  • 41,281
  • 29
  • 127
  • 212