How to get number of users online in asp.net

Membership class example: how to get number of users online in asp.net
GetNumberOfUsersOnline.aspx
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    protected void Page_Load(object sender, System.EventArgs e) {
        Label1.Text = "Now OnLine users: " +
        Membership.GetNumberOfUsersOnline().ToString();
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Membership class example: how to get number of users online in asp.net</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <h2>GetNumberOfUsersOnline method example</h2>
        <asp:LoginStatus ID="LoginStatus1" runat="server" />
        <br />
        <asp:Label ID="Label1" runat="server" Font-Size="Large" ForeColor="DarkGoldenrod"></asp:Label>
        <br /><br />
        <asp:LoginName ID="LoginName1" runat="server" FormatString="Hi {0}!" Font-Size="Large" ForeColor="Red" />

    </div>
    </form>
</body>
</html>






Related asp.net example