Free Download:
|
 | |
 | subgurim | | Asp.Net User |
| problems with Membership.isOnline() | 12/2/2005 4:39:07 PM |
| 0/0 |   |
|
Hi, I'm making a forum, and in the posts I want to show some profile characteristcs and show if the user is online. The problem is that if I take the user profile of any user, the membership property "LastActivityDate" is updated, and the "IsOnline" returns true when this user is no really online. How can I solve this? For better information, I do something like this: MembershipUser miembro = Membership.GetUser(usuario, false); if (miembro != null) { ProfileCommon profile = Profile.GetProfile(usuario); sb.Append(profile.example);
if (miembro.IsOnline) { sb.Append("Est? online!!"); } }
The Membership.GetNumberOfUsersOnline property also turns a bad value I think that this could be solved, isn't it? if not, how do (for example) this website give some user profile properties and at the same time give the total number of users online?
Thanks in advance.
subgurim.net: blog de ASP.NET 2.0 con C# en castellano es-asp.net: el portal de ASP.NET en castellano |
 | Xanderno | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/3/2005 10:39:05 AM |
| 0/0 |   |
|
Well, what do you mean by "not really online."? Do you mean you
closed the browser window that that user was logged into, and refeshed
another browser window?
If that's the case, then yes, I'd say that's probably the expected
behaviour. Remember, HTTP is stateless, meaning there's no
persistant connection between the server and the client, so there's no
such thing as guaranteed notification when a client "leaves" your
site. Once the server has responded to a request, it's over and
done with, and that connection is gone. So, the online status is
going to be more of an approximate value akin to active sessions than
an actual specific count of connected clients.
Now, if you mean that you're seeing a user that hasn't been logged-in
in two weeks showing up as online, I'd say that would be a different
issue.
|
 | markberr | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/8/2005 6:09:42 PM |
| 0/0 |   |
|
For Membership, we say a user is on-line if the last date of activity falls within a configurable "online window". As Xanderno points out, it's impossible to truly determine if a user is on-line. At best, you can guess based on activity.
Thanks, Mark
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights. |
 | subgurim | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/8/2005 11:34:27 PM |
| 0/0 |   |
|
Xanderno:
It's the second issue: a user not logged in two weeks is considered online. I understand the mechanism of http ;)
Thanks!
Markberr:
Yes, that's correct and I know it, the problem is that if I take programatically the profile of a user (ProfileCommon profile = Profile.GetProfile(usuario);), this "last date of activity" is automatically updated.
This is the reason that makes that a user logged a long time ago is considered online... and I think it have no sense!!
Is there other solution???
Am I correct??
Thanks in advance
subgurim.net: blog de ASP.NET 2.0 con C# en castellano es-asp.net: el portal de ASP.NET en castellano |
 | markberr | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/13/2005 12:29:47 AM |
| 0/0 |   |
|
The behavior you're seeing is expected. When you lookup up the profile for a user, we update that user's last activity date (LAD) which affects their "online" status for Membership.
At some level, we have to make a decision on whether or not an operation is indicative of "user activity". Looking up a user's profile data just happends to be one of those cases, but I can see that in an administrative environment where you're just pulling up the data, this doesn't make sense. Except for an explosion in the number of API's, it would be nice to have overloads that allow you to skip updating a user's LAD. We have such an overload for Membership.GetUser(...).
I'll start an internal thread with the team to see if we should overload some of the API's in the next release.
Thanks, Mark
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights. |
 | subgurim | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/13/2005 10:57:48 AM |
| 0/0 |   |
|
yes markberr i was thinkning exactly the same. I've seen that there is the overload you said with Membership.GetUser(...), and it will make sense the same one for Profile.GetProfile(...)
Thanks for your attention
subgurim.net: blog de ASP.NET 2.0 con C# en castellano es-asp.net: el portal de ASP.NET en castellano |
 | subgurim | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/13/2005 1:59:47 PM |
| 0/0 |   |
|
Another related thing... I don't know if this is the correct side to say this, but I think that with an easy AJAX function would be relatively easy to know if the user is really online: assing an AJAX-Javascript function that polls to the server every onlineTimeWindow minutes. The bandwidth needed would be xtremelely little
subgurim.net: blog de ASP.NET 2.0 con C# en castellano es-asp.net: el portal de ASP.NET en castellano |
 | markberr | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/13/2005 4:49:35 PM |
| 0/0 |   |
|
Thanks for bringing up the issue. We'll be reviewing this API and possibly all API's which update a user's Last Activity Date in a future release.
Mark
This posting is provided "AS IS" with no warranties, and confers no rights.
This posting is provided "AS IS" with no warranties, and confers no rights. |
 | Pekestoemp | | Asp.Net User |
| Re: problems with Membership.isOnline() | 7/17/2006 1:37:23 PM |
| 0/0 |   |
|
Hello,
I'm pretty new in this forum...
I think that it might be a good work-around, just after you have used the getprofile/save etc to save a profile to use the Getuser, to change the LAD = lastlogindate and to save this into the membershipuser...
This really avoids to have the incorrect isOnline value.
Hope this helps...
Please feel free to let us know :-)
Regards
Pekestoemp |
 | subgurim | | Asp.Net User |
| Re: problems with Membership.isOnline() | 7/20/2006 10:06:06 AM |
| 0/0 |   |
|
Hello Pekestoemp, Yes, finally it has been solved in this way 
subgurim.net: blog de ASP.NET 2.0 con C# en castellano es-asp.net: el portal de ASP.NET en castellano |
 | balam | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/1/2006 7:51:09 PM |
| 0/0 |   |
|
A little more detail on the fix identified above
A common scenario is to display read only user, profile, and role information in a grid to and administrator. Read only access to role information causes the LastActivityDate to be revised.
sample code DataTable dt; DataRow dr; foreach (System.Web.Security.MembershipUser _User in _Users) { dr = dt.NewRow(); dr[0] = _User.UserName; dr[1] = _User.IsOnline; dr[3] = _User.Email; // save UserLastActivityDate so it can be reassigned later DateTime UserLastActivityDate = _User.LastActivityDate; dr[4] = UserLastActivityDate; // !!! GetProfile alone does NOT cause an update to LastActivityDate ProfileCommon _profile = Profile.GetProfile(_User.UserName); // !!! accessing profile property is what causes and update to LastActivityDate dr[5] = _profile.FirstName; dr[6] = _profile.LastName; // need to reset the UserLastActivityDate that has just been updated by above two lines _User.LastActivityDate = UserLastActivityDate; Membership.UpdateUser(_User); // also display role information in the Grid dr[7] = Roles.IsUserInRole(_User.UserName, "Admin"); dr[8] = Roles.IsUserInRole(_User.UserName, "Employee"); dt.Rows.Add(dr); } GridViewUsers.DataSource = dt; GridViewUsers.DataBind();
This workaround is wateful of CPU and IO. Microsoft we need an overloaded GetProfile like GetUser.
|
 | balam | | Asp.Net User |
| Re: problems with Membership.isOnline() | 12/1/2006 7:51:29 PM |
| 0/0 |   |
|
A little more detail on the fix identified above
A common scenario is to display read only user, profile, and role information in a grid to and administrator. Read only access to role information causes the LastActivityDate to be revised.
sample code DataTable dt; DataRow dr; foreach (System.Web.Security.MembershipUser _User in _Users) { dr = dt.NewRow(); dr[0] = _User.UserName; dr[1] = _User.IsOnline; dr[3] = _User.Email; // save UserLastActivityDate so it can be reassigned later DateTime UserLastActivityDate = _User.LastActivityDate; dr[4] = UserLastActivityDate; // !!! GetProfile alone does NOT cause an update to LastActivityDate ProfileCommon _profile = Profile.GetProfile(_User.UserName); // !!! accessing profile property is what causes and update to LastActivityDate dr[5] = _profile.FirstName; dr[6] = _profile.LastName; // need to reset the UserLastActivityDate that has just been updated by above two lines _User.LastActivityDate = UserLastActivityDate; Membership.UpdateUser(_User); // also display role information in the Grid dr[7] = Roles.IsUserInRole(_User.UserName, "Admin"); dr[8] = Roles.IsUserInRole(_User.UserName, "Employee"); dt.Rows.Add(dr); } GridViewUsers.DataSource = dt; GridViewUsers.DataBind();
This workaround is wateful of CPU and IO. Microsoft we need an overloaded GetProfile like GetUser.
|
 | snsprint | | Asp.Net User |
| Re: problems with Membership.isOnline() | 10/8/2007 10:07:59 PM |
| 0/0 |   |
|
I just spent about 4 hours today trying to figure this one out!
What had me totally confused was that only some of my user's LastActivityDate fields were being updated when their profile properties were accessed, while others did not change. I discovered that it is not just the "accessing" of the profile property that causes LastActivityDate to change (as stated above), but rather the accessing of a profile property that contains data. For instance I have a boolean profile property called "SendMeEmail". If the property is not set the user's activity date was not changing when the profile property was read, but if the field was "true" then the activity date was updated. This may seem like an insignificant point, but it created what appeared to be inconsistent and confusing behavior.
Oddly enough the Profile.Save() method does not cause the LastActivityDate to change, so at least we don't have to waste additional SQL cycles when the profile is saved.
Thanks for your explanation and solution above! |
 | naturehermit | | Asp.Net User |
| Re: problems with Membership.isOnline() | 10/12/2007 3:38:05 PM |
| 0/0 |   |
|
If you use Static methods to have this, then only one instance will execute at any given time anyway.
Please Mark Post that helped you as answer, also include a summary of what solved the problem as it helps others in similar situations |
 | acidcool524 | | Asp.Net User |
| Re: problems with Membership.isOnline() | 2/27/2008 12:18:16 AM |
| 0/0 |   |
|
Ouch, I read this article from Peter Kellner regarding making two providers for membership to change password programatically, without the question and answer feature. MembershipUser mu = Membership.Providers[?SqlMembershipProviderOther?].GetUser(username);
I thought I could do the same with profiles. ProfileCommon p = Profile.Providers["AdminProfileProvider"].GetProfile(Request.QueryString["username"]);
But unfortunately I'm mistaken. Since I am using SQLTableProfileProvider as my profile provider, I tried to make (2) Profile providers on my web.config.
<add name="TableProfileProvider" type="Microsoft.Samples.SqlTableProfileProvider" connectionStringName="test" table="ProfileTableName" applicationName="Test"/> <add name="AdminProfileProvider" type="Microsoft.Samples.SqlTableAdminProfileProvider" connectionStringName="test" table="ProfileTableName" applicationName="Test"/>
On Microsoft's SQLTableProfileProvider source code, they are calling UpdateLastActivityDate(conn, userId) when you extract or save the profile. So what I did was to remove this function call on my SQLTableAdminProfileProvider source code, so there will be no updates made to LastActivityDate. All was set but ProfileCommon p = Profile.Providers["AdminProfileProvider"].GetProfile(Request.QueryString["username"]); is not supported. Sigh :(. |
|
| |
Free Download:
|
Books: The Internet Encyclopedia: G - O Authors: Hossein Bidgoli, Pages: 880, Published: 2004 TruCluster Server Handbook Authors: Scott Fafrak, ScienceDirect (Online service, Pages: 0, Published: 2003 Peer-to-peer Programming on Groove Authors: James Edwards, Pages: 483, Published: 2002 Network Security: The Complete Reference Authors: Roberta Bragg, Mark Rhodes-Ousley, Keith Strassberg, Pages: 854, Published: 2004 Nurse as Educator: Principles of Teaching and Learning for Nursing Practice Authors: Susan Bacorn Bastable, Pages: 571, Published: 2002 E-Business and ERP: Rapid Implementation and Project Planning Authors: Murrell G. Shields, Pages: 267, Published: 2004 Fuzzy Theory Systems: Techniques and Applications Authors: Cornelius T. Leondes, Pages: 1777, Published: 1999 Civic Discourse and Digital Age Communications in the Middle East Authors: Leo A. Gher, Hussein Y. Amin, Pages: 319, Published: 2000 Essentials of Patient Education Authors: Susan Bacorn Bastable, Pages: 502, Published: 2006 Web:problems with Membership.isOnline() - ASP.NET Forums The problem is that if I take the user profile of any user, the membership property "LastActivityDate" is updated, and the "IsOnline" ... problems with Membership.isOnline() - ASP.NET Forums ASP.NET Forums » General ASP.NET » Security » problems with Membership.isOnline( ) ... Re: problems with Membership.isOnline() ... Blitz Members Area - New site is online - SuperNerd - Other broadband Hello, There is now a new members area for ex Blitz customers who elected to ... Curtis, sent you a private message re: problems connecting to mail server. ... OnlineUsers vs. Membership.IsOnLine - Extend It! ( Programming in ... Which caused me to believe this was the problem I had on my site, since I allow using ... Membership.IsOnLine (from the code) I get true! ... The PSA Member Directory is Online! - Brief Article | PSA Journal ... The PSA Member Directory is Online! - Brief Article from PSA Journal in Arts ... Though this may create problems for those officials who need sorted lists ... MySpace.com - App-Ground [ NEW SHAREWARE] Human is online ... MySpace music profile for App-Ground [ NEW SHAREWARE] Human is online... with ... you on here and let me know if you have any problems with your membership. ... Update LastActivity of user in asp.net membership : membership ... Hi experts i use a gridview to get all users of the membership class and i also get the isOnline column how can i update this column in real time for each ... Where is Online Content Licensing Going? Online Conference for ... Topic: Where is Online Licensing Going? ... This is scheduled to be an online/ telephone conference that members of the ShoreViews Premium community will be ... Gazette: Issue 4 (September) is online : Aust MS Skip to content. Member login | Forgot your password? Username: Password:. Member login ... Gazette: Issue 4 (September) is online. 05 Sep 2008 ... seeing if member is online - Goozex Your video game trading community with game reviews, cheats, trading and many other information. Videos: Roger Fisher founding member of Heart Q and A Founding Heart guitarist Roger Fisher holds a Q and A session before a solo show. Famous for songs like Barracuda and Crazy on You, Roger answer ques... Variant Edition Episode 51 Episode 51: another episode packed with reviews!
Spider-man 3 is dominating the theaters…and we’ve got plenty of spidey goodness including reviews o... Club Penguin- Free Kinda Rare Member Account check it out! info in vid Masterchef amsterdam Cooking Excellence Through Exchange of Knowledge Amongst the club members. this is online resource for today's amateur Chef.
Filled Squid Variant Edition Episode 51 Episode 51: another episode packed with reviews!
Spider-man 3 is dominating the theaters...and we've got plenty of spidey goodness including reviews... First Mile project, Tanzania - Part 1 This video shows the First Mile project, one of the activities of Kilosa Telecentre.
The "First Mile" project supports groups of local learners in ... Dismal Large CH47 Dismounted Air Assault Iraq 1/2 dynmicpara First, what-in-the-hell are DARK GREEN CH-47 Chinooks of the 101st Airborne (Air Assault) "Screaming Eagles" doing flying in broad daylight in BLUE S... First Mile project, Tanzania - Part 2 This video shows the First Mile project, one of the activities of Kilosa Telecentre.
The "First Mile" project supports groups of local learners in ... The Mr.Wigglies! I made this movie for my Warrock clan,The Mr.Wigglies!
It's specially made for presenting the members..A frag movie will come too.;)
Enjoy and if you... First Mile project, Tanzania - Part 3 This video shows the First Mile project, one of the activities of Kilosa Telecentre.
The "First Mile" project supports groups of local learners in ... |
|
Search This Site:
|
|