Rauf
Rauf

Reputation: 12842

Communication between .Net Desktop Application and ASP.NET Web application

Scenario 1:Working

From a Windows Desktop Application, I open a browser window (with the help of ShDocVw.InternetExplorer), load a page of a hosted site and sets a property to some value( say, lblName.Text = "Steve M."). Now, using the ShDocVw.InternetExplorer, I can check if a browser object exist with a specified name. By doing so, I will prevent to open duplicate browser window.

Scenario 2:Issue

Now, I want to do the following. I will open the previous page by typing the address in Internet Explorer's address bar. So it will load with the same name( say, lblName.Text = "Steve M."). If I open the Desktop Application and repeat the Scenario 1 a duplicate window will be opened.

How can I prevent the issue ?

I tried with adding reference of Desktop Application to Web application. But nothing worked :(

Upvotes: 0

Views: 629

Answers (1)

user191966
user191966

Reputation:

Do you control that asp.net site (can you change its code)?

I don't know enough about desktop apps to tell you if that's even possible; it seems impossible or very difficult to me; after all, it's the browser's private-to-opened-webpage business what JS objects it's got running for it [the page].

However, maybe you can do this: as that JS object initializes, use JS code to change the page title to something fixed that will mean to your desktop app that that object you're looking for has been made ready.

E.g, normally, the page title is "My Special Page" when that page loads. Maybe after the object is loaded, you can change the title to "My Special Page Ready" (or something that won't make it look weird to the user, if you even care).

Then, you can look for "My Special Page Ready" browser windows, from within the desktop app doing the process search, and if you don't find one, you launch the browser; otherwise you don't. It's fairly simple, compared to researching how to ask IE (or other browser you're working in) to tell you if some variable within its opened tabs exists and has a value (again, if that's even possible).

Upvotes: 1

Related Questions