Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
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 29-Nov-11 3:42am
Edited 29-Nov-11 4:01am
RaisKazi at 29-Nov-11 10:02am
Edited: 1) Formatting 2) Spelling corrections.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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()
                  OleDbDataAdapter da = new OleDbDataAdapter("select * from tblOnlineusers", olecon);
                  DataSet ds = new DataSet();
                  gridview1.DataSource = ds.Tables[0];
            catch (Exception e1)

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.
print a default message

hope this is helpful otherwise send reply i will send full source code of my project
vikranth reddy
pal5hah at 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 at 30-Nov-11 23:53pm
but how will i manage that tblonlineusers table???for login logout..
Prince Antony G at 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,
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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#[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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
show notification
this how you can resolve this problem.
pal5hah at 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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

take a look at this <a href="">link</a> code project membership provider.
But remember this is only used when you want to perform all the user related tasks with this.

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

  Print Answers RSS
Your Filters
0 Shai Vashdi 1,838
1 OriginalGriff 313
2 Tadit Dash 300
3 Sergey Alexandrovich Kryukov 250
4 Peter Leow 220
0 Sergey Alexandrovich Kryukov 9,440
1 OriginalGriff 5,618
2 Peter Leow 4,280
3 Maciej Los 3,540
4 Abhinav S 3,363

Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 30 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid