Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted
Updated 29-Nov-11 4:01am
v2
Comments
RaisKazi 29-Nov-11 10:02am    
Edited: 1) Formatting 2) Spelling corrections.

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
 
Share this answer
 
Comments
pal5hah 30-Nov-11 0:24am    
Thank you very much for your response.but how should i maintain that table that,whenever that user will be logged in then user id will be inserted and whenever that user be log out that user data will be deleted..i am not understanding
pal5hah 30-Nov-11 23:53pm    
but how will i manage that tblonlineusers table???for login logout..
Prince Antony G 1-Dec-11 23:51pm    
Here u cant maintain the Logout Status.That create a big problem.Logout may occur due to Session timeout,Browser Close,
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#[^]
 
Share this answer
 
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.
 
Share this answer
 
Comments
pal5hah 30-Nov-11 0:46am    
thank you for reply,but how can i use membership provider.No idea for that.Can you tell me in brief please.
take a look at this <a href="http://www.codeproject.com/KB/aspnet/CustomMembershipProviders.aspx">link</a> code project membership provider.

But remember this is only used when you want to perform all the user related tasks with this.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900