views:

902

answers:

3

Hi.

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.

A: 

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
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
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
The app i'm writting must be certified and i'm pretty sure that this kind of behaviour will be classified as abnormal :/
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
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
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
appropriate message but i want to also display cannot connect dialog, just as ie does. Opening ie would confuse the user.
@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
A: 

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
@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
@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
+1  A: 

Here's a link where you may find the answer (I'm trying to figure out how to use it):

http://msdn.microsoft.com/en-us/library/aa456107.aspx

MusiGenesis