First hi and thanks in advance in ASP.NET : assume that i have a web site, and there are many users. i want to inform a specific user about some thing happened by other one ,or generally any thing like an incoming message from other one . all that should be happen while this user (who i want to inform) has opened his web page , (let's say an message box) to be opened or the link that takes him to his messages changes it's color (with out refreshing the web page !). i have looked for that in ajax and it gives good things but not exactly what i want, if some can help plz do
You'll need to clarify somewhat what you are talking about here:
- Do you mean that you want one user's actions to trigger a message to another user?
- Or is it merely that a user should be messaged because something has changed from the server's perspective?
- In sending the message, what would you expect to be using? AJAX is an option but there are other ways to send messages back and forth though I would note that AJAX can cause some problems if a user leaves the window open for a long period of time the server recycles its app pool and the session data is lost that the application requires to run properly.
- Could you please use paragraphs and proper English syntax? Seeing everything in one sentence is mildly confusing and doesn't help you if others are just getting confused trying to understand what you are wanting.
- Did you exhaustively try multiple AJAX implementations and uses to see if it could do what you wanted? Please list what you tried so that if someone knows what you may have missed this can be acknowledged.
Without some answers to these it is hard to give a good answer without making tons of assumptions.
It sounds like you're talking about 'push' notifications. Unfortunately, that's just not the way the web is designed. Rather, it's set up so that a user asks for a specific resource and the web server provides it if it can. One request always returns exactly one response.
This means that you need to simulate the push service by creating a heartbeat between a rendered browser page and your server. The web page will have javascript that tells the browser to periodically ask the server, "Do you have any changes for me?" You can implement that in ASP.Net AJAX using the timer control, but it can be tricky to get it right. There are lots of little gotchas you need to watch out for.