global component to manage current users

W

wh

The application that I'm about to start working on requires maintaining a
list of users currently accessing an asp.net application running on IIS5.0.

I essentially need to monitor which xml files on the server various users
are working on. When a user selects an xml file, it is marked as 'locked'
thus disallowing other users from modifying it. The users will come and go
and I therefore need to remove the 'locked' flag from the respective xml
files they were working on. (I assume I can add code to the Session_OnEnd
event to remove locks from files caused by users not logging out properly).

The number of users in the system is expected to be very few at a single
time (maximum of 3).

My idea is to have a global object that can be accessed by users from other
sessions. It would provide an interface something similar to:

myobject.LockXmlFile()
myobject.ReadXmlFile()
myobject.UnlockXmlFile()

The object would then keep track of what xml file is being used by each user
(via the Session ID). My question is what issues would I need to look at in
terms of multiple pages accessing the global object at a single time? I
understand that the component needs to be free threaded. Presumably I'd need
to perform all locking inside the component to ensure there are no race
conditions. Do I need to 'mark' the component as free threaded or does .Net
assume that it is free threaded?

I plan to create an instance of the global object in the
Application_OnStart() event and store it in the HttpApplicationState object
via the Application variable. I am aware that upon processing a request, the
HttpRuntime selects an HttpApplication object from a resource pool. Would
the global object I am creating be accessible from other HttpApplication
objects used by requests from other users? All requests are being accessed
in the same worker process though on different threads so I don't see a
problem there - am I correct?

Wayne.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top