views:

528

answers:

2

I have two Silverlight apps with the following line of code:

HtmlPage.PopupWindow(new Uri("http://www.microsoft.com"), "test", null);

The first app (a simple test app) ALWAYS pops up a new browser window correctly.

The second app (my actual, more complex app) pops up a browser window correctly the FIRST time I launch the app after a reboot, but if I close the app and launch it again, nothing happens when the line above is executed. If I reboot (Vista) it then works correctly again the first time only.

Both apps are installed in the same IIS application folder, use the same web.config, and have identical .aspx hosts (except for the aspx filename and silverlight app name of course).

This second app makes various web service calls back to the same domain (and same application folder), but otherwise doesn't interact with with anything other than UI (i.e., no IsolatedStorageFile read/write -- but it does retrieve cookies if that makes any difference).

I've set AllowHtmlPopupWindow with:

<asp:Silverlight ID="Xaml1" runat="server" AllowHtmlPopupWindow="true"

I don't know how the following is related, but interestingly, the first (test) app works correctly whether AllowHtmlPopupWindow is set, as above, or not. AND, even if it is set as above,

HtmlPage.IsPopupWindowAllowed

is always false (whereas in the second app, IsPopupWindowAllowed is true when it works correctly and false when it fails).

Anyone have any ideas?

A: 

It appears that the problem lies in the calls to the web service. I found that if I close the web service explicitly with the proxy call:

proxy.CloseAsync();

then a subsequent call to HtmlPage.PopupWindow works fine. The value of IsPopupWindowAllowed was also consistent in this case. (Still don't know why PopupWindow worked correctly in the test app when IsPopupWindowAllowed was false.)

A: 

AllowHtmlPopupWindow is true by default for non-cross-domain apps (http://msdn.microsoft.com/en-us/library/cc974117%28VS.95%29.aspx). You bigger app makes calls to web services, so it is cross-domain and AllowHtmlPopupWindow is false by default. This only explains your last remark though...

Mikhail