How to create a unified notification system in asp.net

I am trying to do something similar to a stackoverflow notification when you earn a new icon or privilege. stackoverflow shows the message at the top of the page until you close the message and then see it again.

I can create a message, but my question is how to track that the user has closed the message and no longer displayed it?

using asp.net 4.0 with jquery.

thanks

+4
source share
2 answers

One approach (if you don't care too much about tracking notifications and who saw them) is to have a table that stores notifications for users, and then delete this line when they reject the notification.

For example, if they get an icon:

INSERT INTO NOTIFICATIONS..... 

THEN when they clean it (via AJAX I guess)

 DELETE FROM NOTIFICATIONS... 

And when loading the page, you can simply collect all the notifications for the current user and display them.

This has the advantage of preventing the β€œever-growing table” by only saving entries for current notifications and deleting them when they are no longer needed.

+2
source

You need to use AJAX and send a notification back to your ASP.net level and mark the notification confirmed in your support database. (Alternatively, you can use cookies or some other local storage available in HTML 5, but I would not recommend them, and I'm sure this is not how SO does it.)

+2
source

Source: https://habr.com/ru/post/1391056/


All Articles