5

On windows mobile when there is no internet connection and I try to browse the web using internet explorer i get cannot connect information at the top of the screen. It says cannot connect with current connection settings. To change your connection settings, tap settings. And I am able to tap Settings and setup network connections. How can I display cannot connect information programmatically? When I cannot connect to a webservice using my application I would like to show the same information and let the user set up network connections. I use compact framework 2.0 and csharp.

Thanks in advance.

Mat Nadrofsky
  • 8,289
  • 8
  • 49
  • 73
  • Who the heck down-voted this question? This is a completely legitimate question that I'm very interested in knowing the answer to. – MusiGenesis Nov 18 '08 at 12:53

2 Answers2

0

This is not the best answer, and I hope someone has a better one, but: one thing you can do when your app is not able to reach the webservice is to use the Process class (in System.Diagnostics) to start your webservice URL in Internet Explorer (aka "shelling out").

This will cause IE to appear, and since it can't see the webservice either, it will show the Settings dialog that you need. Once you change your settings so that you can see the webservice, you just close IE and now you're back in your app (which will now be able to see the webservice).

MusiGenesis
  • 74,184
  • 40
  • 190
  • 334
  • unfortunately, opening internet explorer is not an option. but maybe you know if cannot connect dialog should appear automatically or it should be invoked manually? maybe this kind of behaviour is a bug in my application –  Nov 18 '08 at 13:50
  • No, your app is fine. I run into this problem all the time. My quick solution is to deploy with the app a URL.txt file that contains the webservice URL. If a customer can't connect with my app, I have him open the file and click. IE then prompts him with the settings dialog. Why isn't IE an option? – MusiGenesis Nov 18 '08 at 14:03
  • The app i'm writting must be certified and i'm pretty sure that this kind of behaviour will be classified as abnormal :/ –  Nov 18 '08 at 14:15
  • I guess it depends on who's doing the certification. :) Having applications automatically open a browser window (like for help or the company's web site) is pretty common. Less so on PDAs, but mainly because they're usually not connected. – MusiGenesis Nov 18 '08 at 14:25
  • If the certifier is technically knowledgeable, they would understand that it's less risky to let IE handle this than letting users of your program access it programatically. – MusiGenesis Nov 18 '08 at 14:27
  • The scenario is as follows: user needs to login to the application and this is done through the underlying webservice. The user logs in using standard windows form and even doesn't know if this done through webservice or anything else. I able to catch the exception and display message box with –  Nov 18 '08 at 14:32
  • appropriate message but i want to also display cannot connect dialog, just as ie does. Opening ie would confuse the user. –  Nov 18 '08 at 14:34
  • @empi: I just asked another question about this that I hope will get an answer. I'm clueless about this one, and I've wanted a solution for a long time. – MusiGenesis Nov 19 '08 at 00:02
0

Enabling notifications for third party programs via

"Start > Settings > Sounds & Notifications"

might help (at least if you use the ConnectionManager, e.g. through HttpWebRequest).

Regards, tamberg

tamberg
  • 1,987
  • 14
  • 23
  • i use webservice through standard webrefrence in visual studio project. i cannot find the setting you're speaking of. in sounds & notifications i cannot find any options for third party programs. i'm using windows mobile 6. –  Nov 18 '08 at 15:14
  • @empi: tamberg is referring to a setting on your Windows Mobile device. Follow the above path to a dialog with Sounds and Notifications tabs. In the latter, you pick an event to be notified of, but there is no "can't find URL" event, so this won't work. – MusiGenesis Nov 18 '08 at 22:41
  • @MusiGenesis: i've seen your question http://stackoverflow.com/questions/300607/how-do-i-set-network-management-settings-or-make-the-dialog-appear-in-c-on-wind.i've tried to use ConnectionManager native API but with no result.even though it couldn't connect, it still didn't display "cannot conn" dlg –  Nov 19 '08 at 08:32