Skip navigation.

Farewell to ModalsAll recent postsCrash...Boom... Bang

Weather Control ver 1.8

Shannon Hager pointed out that my weather control was vulnerable to exceptions thrown as a result of DNS resolution and other network errors. Up until now the control would throw an exception from its template constructor and you would have no chance to handle it. Granted, you should always use custom error pages, but the weather control would take down the entire page.

I’ve added an event, Error, which you can wire server-side. I’m providing this event so that the user sees a friendly message, and the developer has a chance to trap the exception and do something about it. What I do is I email to myself the error message and the entire stack trace.

It’s very easy to add an error event handler. Check control’s documentation and see the accompanying sample.

From now on, if the control can’t connect to weather.com or encounters some other problem upon initialization, it would simply write out Weather forecast is not available at this time. The page itself remains functional, and the control doesn’t blow up anything.

Please, download the latest binaries and source code. If you only use the compiled assembly simply replace the old one.

Comments

Comment permalink 1 Anonymous |
And I though that ASP.NET was powerful *before* I saw the product for it named "Weather Control ver 1.8". What can I say, I'm impressed.

I have a co-worker who I dislike, can you please smite him with lightning for me? I have his IP address if you need that.
Comment permalink 2 Siberius |
I signed up for the web service, downloaded the zip file and put the .dll in my toolbox for VS. The program still doesnt work with the proper lic, product, and location numbers. Please help.
Comment permalink 3 Milan Negovan |
Siberius, I need you to wire the Error event (see the sample) and display it. Please let me know what it says. You get also get to the error wording if you step to it in the debugger.
Comment permalink 4 Leon |
Has anyone figured out how to display forecast data? This control is great for current weather...forecast data is missing though :( Please Help!
Comment permalink 5 Milan Negovan |
Leon, the control doesn't display forecasts. It is done so by design. I intended it to be a "widget" of a sorts without the bloat of forecasting.

Weather.com provides an SDK which allows you to easily pull down a forecast. You can take advantage of it and devise a templated control.
Comment permalink 6 kris |
Hi i am trying to use this control in my asp.net application. I have done all the things which were discussed, but still recive the general error message that the "Weather forecast is not available at this time." Please help
Comment permalink 7 Milan Negovan |
Can you wire the Error event in code-behind and see what the exact error message is?

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):