Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
Is it possible to check if a user is in a specific page?
I have game rooms page and I would like to do a function which
checks say every second if a a user which I have his nick is in this page.
For example I have the nick "Josh" and I want to check if Josh is in the page "game.aspx".

Any Ideas?

Thank you.
Posted

There is no way for the server to call a client directly without some action being initiated by the client. Think about it. Many sites collect information about the clients who connect to their site. Would you want anyone of them to connect to your web browser at any time?

You will need a mechanism that has the client send a ping to the server at certain intervals to indicate they are still connected.
 
Share this answer
 
You could use a session variable that's updated in the Page Load method.
 
Share this answer
 
but the application which saves the game status will stay true when he exits the browser so it will say he is still in the game while he isn't!
if i could just get the session value when session_end happens everything would be great

I am trying to use this code

C#
if (Application["player1"] == Session["mynick"])
{
    Application["status1"] = false;
    Application["player1"] = "";
}



in the session_end but when it happens sassion["mynick"] has no value :<</xml>
 
Share this answer
 
v2

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