C# Last Request Time
I am in a C#/ASP.NET environment.
I have a web app that has a series of users logged in - and I have a master user who needs to know the last time all other logged in users went to a page (i.e. makes a Http request). I am able to get a listing of all the users through a set of session variables through the Application variable - but I am unable to get much else from it...
I know I could make a bunch of session variables through the Application variable or make a hash table within a single Application/Session var开发者_如何学运维iable and maintain it as needed - but I feel like there should be a way to ask the Application or some other object the time of the last request from a target session. The server should be keeping track of this time out time anyway...
The purpose of this mini-system is so that we can see the active users and the approximate time of their time out so we can gauge the effect of taking the site down for updates/repairs.
Any help/insight would be appreciated.
So I would guess there's two types of downtime, unscheduled and scheduled.
Unscheduled downtime occurs when there's a bug that's causing your company to lose money and needs to be fixed regardless of how many users are currently on the system. There's not much use in having a system that tells you the amount of active users because it's irrelevant.
Scheduled downtime happens as part of the normal process of fixing non show-stopping bugs and adding features. What I would do in this situation is analyse user trends to figure out at what time the amount of active users is at its lowest. This would minimize the amount of disruption to users. The way I would go about this is take the IIS logs for the last month and create a query in LogParser that groups total requests by time of day, per day, ordered by number of requests, ascending. Jeff Attwood has a nice post on how to use it.
EDIT: I came across this on codeproject via another stackoverflow post. It looks like it might be what you're after. Also, If you're using the Membership provider, you might be able to use the GetNumberOfUsersOnline method.
精彩评论