Home > Back-end >  ASP.NET show dynamic changes on all clients
ASP.NET show dynamic changes on all clients

Time:05-19

I'm a beginner with ASP.NET and webapplications in general.

For a project I have to interact with an enginnering software to read some data, for this I have to to use a ASP.NET project based on the .Net Framework 4.8.

For now I called these functions with buttons and displayed the data in gridviews. The problem is I want to show the data on all clients and the data should still be there when I refresh the page on one client.

To load some data in the gridview I tested it by using a function like this. Load data to datagrid The problem is I can't see these changes on other clients.

Is there a way to implement this?

CodePudding user response:

Well, running some in-memmory code for one user of course will not work for other users. You probably would be best to write a seperate console application, place it on the server, and then say schedule it to run ever 5 minuites or whatever. That console or desktop program would thus then write out the data to a database table. Now, any and all web pages (and users) can now have a grid display that quieres against that database.

The other possbile (if for some strange reason you wanted to avoid a database to persist and store this information?

You could consider using signalR. It is complex, but allows you to push (send) out information to all web clients connected to your system. This involves some rather fancy foot work, and does require your web page to include some JavaScript. As a result, the simple database idea is less work, simple, and does not require many hand-stands.

but, signalR is what is used for say pushing out information to each client browser, you can get started here, since this is a vast topic well beyond that of a simple Q & A on SO.

https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/

  • Related