Last post Feb 18, 2010 10:35 AM by atconway
Feb 17, 2010 05:49 AM|guyind|LINK
I have to different .Net applications running simultaneously. Assume both are windows / web applications.When I update some data in application A
correspondingly data in application B must be updated. Can anyone pls let me know how is this possible?
Feb 17, 2010 09:11 AM|atconway|LINK
There are several different approaches you could take with this. One way to accomplish this is to have your sites poll for the data on an interval. They could call the database or an intermediate service (WCF, .asmx, etc) to request the most current data. Then
based on your polling interval your sites would only be out of sync for a minimal amount of time. If you make the polling interval small enough, you may notice very little difference in the data between the (2) sites. If you used AJAX for example, you could
use its Timer and UpdatePanel surrounding the data to be updated. Then the app could do a partial postback, check for new data, and present it almost flawlessly to the user. If you want to look into these (2) components, check out the following links:
[How Do I:] Implement Dynamic Partial-Page Updates with ASP.NET AJAX?
(This video has an example using a timer to do an example quite similar to your question):
[How Do I:] Use the ASP.NET AJAX Timer Control?
Another option would be if you ventured into the world of Silverlight. Silverlight offers some ability that can make this process even more seamless. It involves creating a WCF push service, that pushes data to the client. WCF includes a polling duplex
binding made specifically for Silverlight which allows a service to push data down to a client as the data changes. If you are interested in looking at this, take a look to the following link:
Pushing Data to a Silverlight Client with a WCF Duplex Service:
Lastly, you could post the data of the one site directly to another URL, but I think this is the least scalable solution since the data to be syncd may not be persisted to an intermediary 1st (like a database), but it is certainly an option. Here is one
example of doing this:
Posting form data from ASP.NET page to another URL:
Hope this helps!
Feb 18, 2010 03:08 AM|guyind|LINK
The video tutorials show an update on the same application. But I am confused as to how u can connect the two different applications and then perform the update. How does AJAX help in connecting two different applications. Could u pls be more explicit in
Feb 18, 2010 10:35 AM|atconway|LINK
Yeah the line below from my 1st post should have been elaborated on a bit:
"They could call the database or an intermediate service (WCF, .asmx, etc) to request the most current data."
The AJAX pieces are just to allow the individual apps query the database for updated data on interval and update somewhat seamlessly. The important piece of this is that the data must be stored in an intermediary like a database. The design I recommended
does not have the (2) apps communicating directly, but each one independently calls the database (either directly or through a service that sits between the applications and the database) to get the most current data. There is never a connection directly
between the (2) applications. They just both call a centralized point to get the most current data, and then you could use AJAX to refresh the UI for the client.
If you wanted to do something more brut to just have the 2 applications communicate directly you could look at using a HTML "POST" and "GET" method to communicate directly between the (2) applications. However if you add additional applications I think
this solution becomes less scalable than the one where all of the clients go to a central point to retrieve the data.