I need to save the list of registered STATUS users at the server level (either "ONLINE" or "OFFLINE").
So, I wrote a Partial View to maintain the current status of the user (online, offline). The server stores these values ββboth in the database and in all current Internet users, as well as in the Cached entry, so that I can get a list of all current "Online" users from the cache.
To save this uptodate list, I now need an asynchronous AutoRefresh call that notifies the server that my user ID is saved in the ONLINE list. This call must be made every xx seconds and should only be made if the current state is ONLINE.
QUESTIONS:
- How to create an AutoRefresh call that runs every XX seconds
- How can I guarantee that this call is made only when I am in ONLINE status.
Thanks in advance.
This is a partial view in question. Where do you suggest I put the code to run AutoRefresh (MasterPage, Main View, Partial View) ???
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <% if (MySite.Security.SiteUser.IsAuthenticated) { if (Convert.ToBoolean(ViewData["IsLogged"])) { %> <div id="onlineStatus"> You are currently ONLINE >> <%: Html.ActionLink("Take a Break", "GoOffline", "Account")%> </div> <% } else { %> <div id="offlineStatus"> Ready for business >> <%: Html.ActionLink("Go Online", "GoOnline", "Account")%> </div> <% } } %>
source share