Weather Control ver 1.8
Posted in Development
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.
9 comments
Siberius
on September 1, 2006
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.
Milan Negovan
on September 5, 2006
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.
Leon
on September 14, 2007
Has anyone figured out how to display forecast data? This control is great for current weather...forecast data is missing though :( Please Help!
Milan Negovan
on September 16, 2007
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.
kris
on June 10, 2008
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
Milan Negovan
on June 13, 2008
Can you wire the Error event in code-behind and see what the exact error message is?
Matthew Brown
on August 26, 2009
I am having trouble getting my web guy to add the "error trapping" and I am not a developer. I loaded the latest DLL, but I still get the error "Weather forecast is not available at this time". Can someone send me a DLL that would trap the error? I am lost.
Prasanna
on March 4, 2010
Hi, I have added weather control on my site, but when i host this page which have weather control on live server it always throws an error related to variable for Farenhight. can somebody tell me what could be the reason

Anonymous
on March 9, 2005
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.