Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 29th, 2008, 06:11 AM
Registered User
 
Join Date: Jul 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default GetNumberOfUsersOnline

I have the following problem while using the GetNumberOfUsersOnline method of the Membership class: The function returns the total number of users instead.

On page 172, this function is used to display the number of users online. I have changed this example to display only users working for a particular company. This information is stored into the Profile of each user. So after executing the GetAllUsers() function to populate allUsers, I pass this value into another function, called GetMSSUsersFromUserCollection:

privateMembershipUserCollection GetMSSUsersFromUserCollection(MembershipUserCollection everyone)
{
foreach (MembershipUser user in everyone)
{
ProfileCommon prof = Profile.GetProfile(user.UserName);
if (prof.CompanyCode == "MyCompany") allMSSUsers.Add(user);
}
return allMSSUsers;
}

This returns only the users belonging to the "MyCompany" company.

In retrieving each user's profile however also updates the user's LastActivityDate field. When the next statement is called to GetNumberOfUsersOnline, this returns all users belonging to the "MyCompany", since it returns those users whose LastAcitivityDate is within the current date and time minus the userIsOnlineTimeWindow period defined in web.config. This obviously gives me the wrong number.

How else could I implement this functionality?

Thanks

Chris
  #2 (permalink)  
Old December 29th, 2008, 04:32 PM
Lee Dumond's Avatar
Wrox Author
Points: 4,942, Level: 29
Points: 4,942, Level: 29 Points: 4,942, Level: 29 Points: 4,942, Level: 29
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2008
Location: Decatur, IL, USA.
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

How to Prevent Profile Properties From Updating a User's Last Activity Date

http://leedumond.com/blog/how-to-pre...activity-date/
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}

Last edited by Lee Dumond; December 29th, 2008 at 04:34 PM..
  #3 (permalink)  
Old December 29th, 2008, 05:34 PM
Registered User
 
Join Date: Jul 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default GetNumberOfUsersOnline

Hi Lee

Thanks for your posting.

I have used a different table in which the username and company are also present in deducing whether a user works for the company or not without fetching information from the profile class.

I nevertheless like your method very much and thank you for posting it.

Regards

Chris
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 09:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.