主题:  [转自己BLOG]用asp.net显示在线登陆人数及位置

EdisonNet

职务:普通成员
等级:1
金币:0.0
发贴:10
#12005/11/22 19:13:07



protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
string strUserID = string.Empty;
string strCompany = string.Empty;
if (Request.IsAuthenticated)
{
FormsIdentity identity = (FormsIdentity)User.Identity;
FormsAuthenticationTicket ticket = identity.Ticket;
strUserID = User.Identity.Name;
strCompany = ticket.UserData.Split("|".ToCharArray())[2];
}
else
{
strUserID = Request.UserHostAddress;
strCompany = "游客";
}

MemberOnlineInfo objOnline = new MemberOnlineInfo(strUserID, Request.UserHostAddress, DateTime.Now.ToString(), Request.FilePath, strCompany);

MemberAccount account = new MemberAccount();
if (!account.CheckUserOnline(strUserID))
account.AddOnline(objOnline);
else
account.UpdateOnline(objOnline);

//删除超时的会员
account.DeleteOnline();
}

地址来源点这里....