无论用户当前是否登录的登录状态 [英] login status that whether any user is currently login or not

查看:80
本文介绍了无论用户当前是否登录的登录状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个有多个用户的应用程序.

现在,一个用户可以向另一个发送消息.如果该另一个用户当前正在登录,则将在另一个用户的屏幕上弹出该窗口,否则每当他登录时都会显示一条通知.

我该怎么办?

Hello all,

I have an application in which there are multiple users.

Now one user can send message to another. If that another user is currently logged in then there will be pop up on another user''s screen else show a notification whenever he become logged in.

What should i do in this?

推荐答案

对于此应用程序实现
要做的第一步是在登录页面中,将当前登录站点的用户的名称,标识插入表中,该表的名称例如为:"tblonlineusers"

defalut.aspx页的第二步或执行的页面的任何内容,请做
以下代码用于检查谁当前在线.

在此页面中,使用网格视图控件并填写有关在线状态下的姓名,id的详细信息.

代码是


公共无效fillonlineusers()
{
试试
{
OleDbDataAdapter da =新的OleDbDataAdapter("select * from tblOnlineusers",olecon);
DataSet ds = new DataSet();
da.Fill(ds);
gridview1.DataSource = ds.Tables [0];
gridview1.DataBind();
}
catch(e1异常)
{
Response.Write(e1.Message);
}

}


此步骤使查找当前登录的用户.
因此,在上述步骤中计算用户数
如果count> 0
然后随便编写代码.
其他
打印默认消息


希望这对您有所帮助,否则发送回复,我将发送项目的完整源代码

谢谢
vikranth reddy
for this application implementaion
first step you have to do is in login page insert the names,ids of the users who are currently logged in the site into a table with a name for eg:"tblonlineusers"

second step in defalut.aspx page or what ever the page you have implement, do
the following code for checking who are currently online.

in this page take a grid view control and fill the details about names,id who are in online.

the code is


public void fillonlineusers()
{
try
{
OleDbDataAdapter da = new OleDbDataAdapter("select * from tblOnlineusers", olecon);
DataSet ds = new DataSet();
da.Fill(ds);
gridview1.DataSource = ds.Tables[0];
gridview1.DataBind();
}
catch (Exception e1)
{
Response.Write(e1.Message);
}

}


this step makes find users currently logged in.
so in the above step count number of users
if count>0
then write the code whatever you want.
else
print a default message


hope this is helpful otherwise send reply i will send full source code of my project

thanks
vikranth reddy


从下面的CP文章下载代码,并查看其他功能"部分以构建此功能,
在C#中使用Web服务的聊天应用程序 [
Download the code from the below CP article and look into the "Extra Functionalities" section to build this functionality,
Chat Application using Web services in C#[^]


您可以使用成员资格提供程序,也可以通过简单的tweek提供用户表中的活动列,并且在用户gettin登录时,将此单元格值设置为true,并且

if(active == true)
显示通知

这就是解决此问题的方法.
you can use membership provider or a simple tweek is provide an active column in user table and at time user gettin logged in make this cell value as true and

if(active==true)
show notification

this how you can resolve this problem.


这篇关于无论用户当前是否登录的登录状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆