Refresh browser's page programmatically, from a .Net WinForms application
browser, c#, refresh, winforms
Solution
This is not easy to do in a way that is robust. Users may not be using IE, for example.
The only thing you control and that is common to the web page and the windows app is your web server.
This solution is convoluted, but is the only way I can think of that would work.
1) Get the web page to open a long-polling connection to the web server before the windows app runs. SignalR is getting good press for this at the moment.
2) Get the windows app to send a signal to the server when it wants to update the web page.
3) On the server, complete the long-polling request, sending a signal back to the web browser.
4) In the web page, handle the response by refreshing the page.
I said it was convoluted!
Problem
From asp.net page, via ClickOnce deployment, a .Net WinForms application is started. At a certain point the WinForm application needs to refresh the web page it was started from. How could I do this? How could a .Net based windows application refresh a page that is already opened in a browser?