Weather Custom Server Control

Posted on September 11, 2004   |   Download sample code

91 comments

Need a quick and easy way to display weather on your site? Templated custom server controls to the rescue!

About a month ago I started looking around for a server control I could simply drop in my page template, configure it really quick and have it display weather information for my area to make things a little more fun. I wanted a control which used a reliable feed of weather information, not a third-party service, not a (God forbid!) screen scraping approach. I think we're done with screen scraping in the era of web services and XML feeds, with the exception of extreme cases when you do need to parse raw HTML. I couldn't find such a control, so decided to write one myself.

As I mentioned, I wanted a highly customizable control. Knowing that most of them out there either produce table galore or lock you into specific markup I wanted my control to allow developers to style it with CSS and come up with their own layouts. Scott Mitchell pointed me to his article at MSDN, and the project got going.

This is not an article on how to write a templated custom server control. Feel free to download the source code along with binaries, documentation and a sample. This is more of a discussion of how to use it on your site, blog, etc.

Getting Registered

One of my requirements was a reliable weather feed. To make things easy and efficient I wanted it to be an XML feed. Weather.com happens to provide a feed free of charge.

Here's how it works: you need to sign up for a Partner ID and License Key. In a way, they are your public/private keys. Once you register, they email them to you. You will need these Partner ID and License Key to place queries to their server(s). The whole process is very easy. When you register they allows you to download an SDK, but you don't need to worry about it unless your want to develop your own widget.

The weather server control I wrote takes these two parameters. The only thing left to give it is the ID of your location (or whichever location in the world, for that matter). In the US a zip code is a valid location ID, but you may still use an alpha-numeric one issued by weather.com. For locations outside of the US you have to use an alpha-numeric location ID. For example, Amsterdam, Netherlands has NLXX0002 assigned to it.

Normally, to resolve a location to its ID you have to place a special query to a weather.com server, but I've put together an online tool to do the same. Please, visit see Weather Location ID Resolver in my Tools section.

Now that you have those three bits in place, you're all set!

Paint Me An Icon

Let's go over all the nifty stuff weather.com offers. They allow you to display current weather conditions as an icon 32x32, 64x64, or 128x128 pixels. The control has all of them embedded into it. All you need to do is set its IconSize property to Small, Medium (default) or Large. Or simply leave the default, Medium.

At run time, the control will try to unpack an appropriate weather glyph on the disk if one isn't there yet. The default path is ccimages and it goes in the root, but you may specify another location via the IconLocation property. If your site is hosted elsewhere, you'll need to be sure you grant ASP.NET (or Everyone) write permissions to this folder.

All weather icons are PNG images. I tried converting them all to GIFs but the converted images suffered from loss of quality. At weather.com they use GIFs but their quality suffers, therefore I'm leaving them as PNGs. It's well known that Internet Explorer/Win has a problem with transparency in PNG images. All other major browsers handle transparency just right. When you look through the sample code you'll see I used a CSS hack to put a border around weather icons in IE/Win so their background won't look that ugly. Lack of appropriate support of PNGs in IE/Win in a bummer, but we have to live with it for now.

Localization

The control does a lot of heavy lifting: it figures out what size of a weather icon you want to display, unpacks and saves it, and builds a complete URL to it. I also wanted to utilize resource files and supply a couple of translations of its output, but weather.com folks painted text right over the images—not a localizable approach. I also asked them to share what textual values to expect, but I never heard back. For example, wind can be calm or variant. Nobody knows if there are other variations. Hence English only it is for now. Bummer.

Ground Rules

To be nice to the provider, we need to obey their attribution rules, which are: Your application must include text attribution and a logo that attributes the weather data to TWCi and links users directly to the weather.com Web site.

I've implemented two properties, WeatherProviderLogo and WeatherProviderLink, both of them build complete HTML tags of an image and a link to weather.com, just like the SDK states. Again, the sample demonstrates proper attribution.

Online Demo

The same sample page you will find in the download is running online. It displays weather information at Smithtown, NY, and Amsterdam. The page validates as XHTML 1.0 Strict and its CSS validates as well. It's only one example of how to customize weather widget output with CSS and structural markup. If you prefer tables, go ahead and knock yourselves out (figuratively speaking).

That's really it. I will post updates here, so stay tuned. I've been running this weather control on my site for over a month now so it has seen some action and has gone through a couple of iterations! I will appreciate comments, bug reports, suggestions.

Sept 30, 2004, update: Tonight my local weather station totally defaulted and returned "N/A" for pretty much everything which blew up where integer values were expected. So much for accuracy of the weather.com schema. I've replaced several ints in weather.xsd with strings to safeguarg against these screw-ups.

If you only deploy the binary, grab the latest download and simply redeploy the DLL.

Also, I'm including a JavaScript file for the demo which fixes PNG transparency in IE 5.5 and up.

Nov 28, 2004, update: Version 1.7 with a new property, LocationID, is out. Please download the source code and binary, and see readme.

Jan 5, 2005, update: Version 1.8 comes with an event, Error, which you can use to trap exceptions. When the control encounters a problem during its initialization, it displays a frienly message to the user and raises a server-side event for the developer.

91 comments

Li-Ping
on September 13, 2004

Hi there

I believe the "i" element in complex type element "uv" of your weather.xsd should be of type "xs:string".

E.g. for location SNXX0006, the returned value is "10+".


Milan Negovan
on September 14, 2004

10+? Wow. Didn't realize it was a string. Weather.com only provides a DTD schema and you can't tell the data type of each field, so I had to make an "educated guess" here and there. Thanks for pointing it out!


Li-Ping
on September 14, 2004

http://www.epa.gov/sunwise/uvilaunch.html

Yes, apparently us folks at the equator have it pretty darn warm. ;)


pick-master
on September 29, 2004

Regarding the png transparency issue, I found this URL that provides a solution.

http://homepage.ntlworld.com/bobosola/pnghowto.htm


Milan Negovan
on September 30, 2004

Thanks! I'm including this PNG fix with the demo page.


Steven
on September 30, 2004

This is terrific! Could your control support forecast information as well as the current temperature? Thanks!


Milan Negovan
on October 01, 2004

The control has 'Temperature' and 'FeelsLike' properties. I will add 2 and/or 5 day forecast information in the next release.


Rick
on December 22, 2004

How would i include this page into my template page (CSK VB)?
I can get the page to work outside my main site, just not sure how to add to page.
Thanks


Shannon J Hager
on December 24, 2004

I am using this weather control in a pet project site I am currently working on and today I ran into a pretty bad error handling problem. I am not exactly sure where the error came from but I think it was due to a DNS problem or possibly network problems where the server is hosted (there were no problems on the local mirrored version of the site). The page errored with a "connection was terminated: could not resolve remote [name? server? I forgot]" error. It was definitely from the weather control, but I'm not sure if it was a DNS problem (not being able to reach the weather service?) or if the service threw an error (unable to reach its database?). The problem only lasted 4 or 5 minutes but I had to remove the control from my page templates in order to get the pages to work. I had similar problems when I tried to work on the site when the server wasn't allowed to hit the Internet. I know that normal usage would dictate that Internet access is required but I think adding another try/catch or something and displaying a generic "Weather Service Currently Unavailable" message would be the way to go.
I have also considered serializing the current conditions to disk (I only check the service every 30 minutes) and using those results if the service is down.

While I'm here, THANKS! This is a great server control, I was a bit surprised (thought I should have known) that, after dropping it onto my ASP.NET page, the page still was still valid xhtml trans. Good job and thanks again.


Milan Negovan
on December 29, 2004

The control allows you to craft your own markup, so it's your accomplishment that your page is valid XHTML Transitional, not mine. :)

Good point about error handling. I need to do a better job at handling errors when weather.com itself goes down or an Internet connection is not available.


Rozanne
on January 02, 2005

I want to start off by saying, wow,thanks. This is a lovely control, beautifully documented too. I discovered it earlier this afternoon and it's been a joy to work with. I'm modifying the control for a dotnetnuke module of mine, to display the weather conditions for a user, and to allow them to enter a different US zip code. It all works nicely - but after refreshing, the image no longer displays correctly. Is there a reason for this? Here is my code:

Dim wccControl As New UserController
Dim zipcode
zipcode = Trim(Me.txtZIP.Text)

If zipcode = "" Then
If Not (MyBase.UserId = -1) Then
Dim x As UserInfo
x = wccControl.GetUser(0, MyBase.UserId)
wccWeather.LocationID = Trim(x.PostalCode)
Me.lblDebug.Text &= ("Setting locationID from userdata: " & Trim(x.PostalCode))
End If
Else

Dim isvalid
isvalid = IsValidZip(zipcode)
If isvalid "" Then
Me.lblfeedback.Text = isvalid
Me.lblfeedback.Visible = True
Exit Sub
Else
Me.lblfeedback.Visible = False
End If
wccWeather.LocationID = Trim(Me.txtZIP.Text)

Me.lblfeedback.Text &= ("Setting locationID from zip box: " & Me.wccWeather.LocationID)
Me.lblfeedback.Visible = True
End If
wccWeather.DataBind() -- this is where I think it's somehow losing the image path??


Rozanne
on January 02, 2005

It's ok ... found it ;-) I moved the location of the ccimages folder. I'm not sure how the images were found, correctly, for the first time the app loaded, if they were in the incorrect location ... but moving them did the trick.


Milan Negovan
on January 02, 2005

Rozanne, I'd like to know a little more about what happened there and how you solved it. If it happened once, it's bound to happen again. :)


Nikhil Kothari
on January 03, 2005

Looks pretty cool...


Steve Quarles
on January 21, 2005

I registered with Weather.com and received my PartnerID and License Key and added the anrControls.Weather.dll as a reference along with creating a ccimages folder and copied the images in. My problem is the control says "Weather forecast is not available at this time." Am I missing something? If I put all the controls from the WeatherControl I get errors when running the project.

Thank you.


Milan Negovan
on January 22, 2005

I suggest you wire its Error event, as I described in a recent post (it's also shown in the sample). If you develop in VS.NET see what the exception message is. Otherwise simply print out the error on the page and let me know what it says.


Damir
on February 06, 2005

Can you provide some info how to install yours component to WebMatrix. I try with "Add Local Toolbox Component" and select anrControls.Weather.dll.
An Error occurred: "No valid Web controls were found in the assembly" after that I must delete *.dll from ..\WebMatrix\components folder but when I try to run demo next error occured: Parser Error Message: 'WeatherControlTest.defaultTest' is not a valid base class because it does not extend class 'System.Web.UI.Page'.
Source Error:
Line 1: [%@ Page Language="c#" autoeventwireup="false" codebehind="default.aspx.cs" Inherits="WeatherControlTest.defaultTest" %]

thx
Damir


Eric
on February 16, 2005

hi
i ve got a pb in WeatherData.BuildImageUrl method

Assembly.GetExecutingAssembly().GetManifestResourceStream (resourceName) always return null

but i ve got added in weather control project all images provided by weather.com

Any idea ?


Eric
on February 16, 2005

I found the problem

The images was not marked as "Embedded Resource" in the weather project.


Another question :
Is there a way to display the next day weather forecast ?


Milan Negovan
on February 16, 2005

Yeah, these is a way. I need to add a forecast template some time in the future and pull down a different XML feed---one that has a forecast for several days ahead.


Bob
on March 25, 2005

First I would like to thank you for posting this excellent control. I have a question on your 'Resolve Weather Location ID'. Is this being resolved locally or via weather.com? If the latter, are you going to make the code to replicate this available? Thanks.


Milan Negovan
on March 25, 2005

Bob, I was so sure I published the code before... but I guess I didn't. I zipped up the ASPX page and its code behind for download.

In a nutshell, weather.com resolves location ID and returns an XML document with all matching locations.


Luke
on July 15, 2005

I am having a problem using your Weather Control. I am getting
Weather forecast is not available at this time. I have taken the URL you had in your code and plugged my values into it and go XML back from weather.com. Any ideas? I also see they images were not included in your download. Will this case this error?

Thanks


Milan Negovan
on July 15, 2005

Luke, take a look at this post. It explains how you can inspect what goes wrong.

Also, images are embedded in the assembly and get extracted at run time.


Luke
on July 15, 2005

Milan thanks for the reply here is what i got for an error.

The Weather control should contain a WeatherTemplate element

Luke


Milan Negovan
on July 15, 2005

Luke, look carefully through the sample page included in the download. The control should have a declaration of WeatherTemplate.


Luke
on July 15, 2005

Ahh I see. Thanks alot for your help.

Luke


Luke
on July 18, 2005

I am having a problem regarding my WeatherTemplate. The Weather Control does not seem to be updating my form schema to allow for the WeatherTemplate. The control does still work, but when I make a changed to the control through the designer it deletes my Template. Any Ideas?
Thanks


Milan Negovan
on July 18, 2005

Luke, I believe someone mentioned it to me before, but I haven't figured out how to stop VS.NET from deleting the template. Not sure why it's happening. The only workaround I can suggest is not to use the VS.NET designer, which is aweful anyway.


New Zealand Web Hosting
on July 19, 2005

Thankyou very much for the link!

We are going to implement this in our website!


Gonzalo
on July 25, 2005

Hi, I'm working on a version with days forecast support.
I want it to know how can I do to define equals entries on the xml (for example "wind" for cc and "wind" for first day) and the Generator of .NET doesn't give me this error:

Custom tool error: Unable to convert input xml file content to a DataSet. The same table (wind) cannot be the child table in two nested relations.

I know... the problem is that define equals tables (in the DataSet) with the same name, but how can I resolve the problem?

Thanks,
Gonzalo


Milan Negovan
on August 01, 2005

Hmm... That's an interesting question, Gonzalo. I imagine there will be a name clash, as you pointed out. I wonder if you need to write your own XmlReader for that.


Sam Parsons
on August 04, 2005

Wow, thank you so much! You made my day.

Quick question though: Does the control automatically cache the XML to the specifications outlined in the SDK?

Thanks again!


Milan Negovan
on August 04, 2005

Sam, yes, as the SDK prescribes, weather conditions are cached for 30 minutes for each location (one location in this case).


Brian
on August 26, 2005

Great Control! The download is missing the PNG's now.. any chance of getting them put back in?


Milan Negovan
on August 29, 2005

My bad. They are in now. Thanks for heads-up, Brian.


Joe Huddleston
on August 31, 2005

I have your sample and I am trying a simple page, but cannot get anything other than the error "Forecast not available." I can access the xml page and have a template defined, but I cannot figure out what is causing the error. Even when using VS.net and stopping after initializingcomponent (VB) I still see no error being thrown.

Any help would be great. I would like to write out the error to the page using VB, but have not been successful.


Joe Huddleston
on August 31, 2005

Got my error....
System.Net.WebException: The underlying connection was closed: [...]


Joe Huddleston
on September 01, 2005

I think I have this narrowed down but still do not know how to solve.
The Event viewer show me trying to access http with the IUSR account. My IUSR account will not have permission for this and I need to impersonate. However, when I impersonate the impersonation does not seemed to be used by the weather control.


Milan Negovan
on September 01, 2005

Joe, have you followed the suggestions in this post to troubleshoot the problem? As far as permissioning is concerned, I'm afraid I don't have much insight into that.


Joe Huddleston
on September 01, 2005

Yes, I followed that post. That is how I determined it was having authentication problems. Has anyone had any success in implementing the with a proxy requiring authentication?


Joe Huddleston
on September 01, 2005

If I was a bit more knowledgable in C# and these controls I might be able to implement the forth coming suggestion and just tell you about it.

I believe some code similar to the below will allow users needing to authenticate to do so. Passing the domain, user, and passsword would be most ideal.

WebProxy myProxy = new WebProxy("http://proxyserver:port",true);
myProxy.Credentials = new NetworkCredential("username", "password", "domain");
FindServiceSoap myFindService = new FindServiceSoap();
myFindService.Proxy = myProxy;


Milan Negovan
on September 01, 2005

Joe, thanks for the tip. You da man!


Joe Huddleston
on September 01, 2005

New error, but i don't kno wi fthis is progress
System.Net.WebException: The underlying connection was closed: The proxy name could not be resolved

//NetworkCredential nc = new NetworkCredential("user", "pass", "domain");
XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = system.Net.CredentialCache.DefaultCredentials;
doc.XmlResolver= resolver;

Added these to WeatherData.cs above the Doc.Load. Requires using System.Net.
I tried defining condition explicitly and using DefaultCredentials. Same error both times.

I hope you don't mind me using this as a debug stop. I am hoping to find someone that knows something.

Your product looks great and I hope to use it.


Joe Huddleston
on September 08, 2005

This finally worked

< defaultProxy >
< proxy
usesystemdefault = "false"
proxyaddress="http://proxyserver:80"
bypassonlocal="true"
/>
< /defaultProxy >


Andy
on September 26, 2005

The code works just great in sub directories but when i take it to the top parent directory it does not work. Also I tried to use the code as a user control and there seems to be a diconnect again, giving me the standard error message. Does anyone have an idea how to use this in a ASP.NET setting as a user control? Thanks for your assistance!!


Rui Marques
on October 20, 2005

Excelent article... In one article i found all i need to know about how to user weather.com feeds in a ASP.NET application.

Thanks!!!


Bill
on October 28, 2005

I am trying to use a textbox and a button to get the new zip from the user and trying to assign the value to weaControl.LocationID property. The problem is the first time I click the button no change occurs, when I click the button again for the second time the control is changing the values. I thougt its problem with my .net framewrok, but everything else is working fine.
Example
If I enter a zipcode 10001 in the text box and click the button no change occurs, the second time I changed the zip to 73301 and click on button, the control displayed the information for zip 10001. for your reference I am providing the code I wrote in the code behind.
Private Sub ZipButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZipButton.Click

If ZipText.Text "" Then
Weather1.LocationID = Trim(ZipText.Text)
Else
Weather1.LocationID = "10001"
End If
Weather1.DataBind()
End Sub


Manic
on November 23, 2005

Could you make a light version of this component (without png images in dll). This dll is to large


Milan Negovan
on November 23, 2005

No, because you'll have to manage images yourself which would make usage of this component awkward. I'd rather keep them embedded.


Deepak
on April 01, 2006

hi,
when i tried to use ur custom control in my aspx page,it is displaying as "Weather forecast is not available at this time"...

I registered with Weather.com and received my PartnerID and License Key and added the anrControls.Weather.dll as a reference

when i dubeg the custom control code ,i noticed these specific below line in "Weather.cs" file

ITemplate template = this.WeatherTemplate;

this "template" variable is getting null,so it is throwing error as "Weather forecast is not available at this time"

What was suppose to be valued in that "template" varibale..
plz reply me with some soultion to deepak.ramaiah@hotmail.com

my last question ,is there any webservice from wether.com or from any organisation which can display us wether forecast of world..
if there is any such webservice,plz let me knwon...

I am using VS.NET 2003

Thank u
Deepak


Milan Negovan
on April 03, 2006

Deepark, please re-read the article. It talks about the web service at weather.com you are looking for. Their feed gives you enough information about any location in the world.


Tryst
on April 03, 2006

So can this be applied to Windows Forms? Maybe I can present this data to controls in a Panel?

Tryst


Milan Negovan
on April 04, 2006

Trystan, I distribute this component with source code. I think it should be possible to turn it into a WinForms control. I'm just not familiar with that side of control development.


Saint_77
on April 18, 2006

Very nice control indeed .... how long before your control will support any forecast information? How soon will a release be available that will support forecast information?
Thanks


Milan Negovan
on April 18, 2006

I don't really have a time frame for this. I make my code available for free, so if anyone wants to extend the control it'd be great.


saju
on June 15, 2006

Hi,
when i used the custom control in my aspx page,it is displaying as "Weather forecast is not available at this time"...

I registered with Weather.com and received my PartnerID and License Key and added the anrControls.Weather.dll as a reference


Michael Hutchison
on June 18, 2006

Nice control. I am having a problem and others too, I see. The control works without any problems on my development machine. On root level pages as well as sub folders. However, when I upload the files to the live site, the root level works but the sub-levels do not. Any help would be greatly appreciated.


Milan Negovan
on June 19, 2006

Saju, Michael,

Take a look at this post for troubleshooting tips. Also, make sure the folder where images go has write permissions granted to the ASPNET account (NetworkService in Windows 2003 Server).


Nico
on October 27, 2006

Wel let me start by complementing you on a very handy component.
But i have one question. How can i display more than 1 day at a time.


Milan Negovan
on October 27, 2006

It takes a different query to the weather.com web service to get a forecast for several days. I don't really plan on doing it, but if anyone wants to implement it, please share. :)


Bill Youngman
on December 12, 2006

I'm using your control in a client's intranet site and they love it. Now they would like to see the forcast along with the other data and I'm trying to accomodate them but I'm running into a problem. I took your code and am using it as a framework and added the forcast elements from the Weather.com sdk to the .xsd file and am in the process of adding the properties to the dll in order to display them in the web page. The problem I'm running into is that dataset returned from Weather.com has data for the stuff like cc, flik etc. but it's showing no rows for the stuff that I added day, hi - etc.

I would appreciate any suggestions/assistance as the documentation from weather.com is pretty poor.

Thanks


Brett
on February 08, 2007

I just downloaded your control and am playing around with the weathercontroltest version. I have added a text box so that a user can enter a new zip code. However, hitting subit does not change the data displayed. Can you let me know what I am doing wrong?

I am using the code below:

Protected Sub btnZip_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnZip.Click
Weather1.LocationID = txtZip.Text
Weather1.DataBind()
End Sub

It seems like it should work, but I have had no luck. Thank you for the help and for the great work.


Boris
on March 05, 2007

Brett,
I think the problem is with the page life cycle. I found the solution but I think that my solution isn't the best way to do it. Anyway, here is how I solved it:
When the user hits the btnZip, read the txtZip and store it somewhere (for example in Session) and redirect to some other page (for example test.aspx). On test.aspx in Page_Load method redirect back to your first page and in the first's page Page_Load method set the LoacationID.


Leon
on September 14, 2007

This is just a fantastic control. I got the current weather displayed on my site, but I now need the forecast data as well. Id this even possible iun the current version? The zip file I downloaded did not contain any documentation. Any help would be greatly appreciated. And again, thanks for the great work!


Milan Negovan
on September 16, 2007

Leon, please see this comment.


Charles
on September 23, 2007

Does anyone know the steps needed to install and use this weather.com control.

I have so far done the following:

Added anr.Controls.weather.dll to the bin folder

Added a reference to anr.Controls.weather.dll

Added the control to my page

Added the PartnerID and License Key

Added the LocationID

Added the ccimage folder and files to my project

But I still get the 'Weather forecast is not available at this time. ' when I run the app.

I appreciate any help,


Milan Negovan
on September 24, 2007

Charles, see this post. I exposed an error event which you can tap into and see what's going wrong.


Leon
on October 01, 2007

Decided to go another route and did the forecast part myself.

here you go...

http://www.codeproject.com/useritems/weathercontrolVB.asp


Milan Negovan
on October 02, 2007

Very cool!


Brijesh
on January 04, 2008

Could you please help me to find the location ID of Singapore.

Thanks!

Looking for the responces...


Milan Negovan
on January 04, 2008

Very strange, weather.com won't give me a location Id for Singapore either. :(


Milan Negovan
on January 04, 2008

Try "SNXX0006". If it doesn't work, pick one of these locations.


Fatih
on January 24, 2008

That's fantastic.

Thank you so much.


Peter Konstant
on January 29, 2008

Hello,

First, I want to thank you for putting this control together and documenting it.

I have VS 2008 and tried to compile your control but I get two errors:

Error 1 The namespace 'anrControls' already contains a definition for 'Weather' weather.Designer.cs Weather
Error 2 The namespace 'anrControls' already contains a definition for 'Weather' WeatherDataError.Designer.cs Weather

Do know what is wrong?

Many Thanks, Peter


wah
on May 21, 2008

Awesome control, nice man.


nasheet
on December 23, 2008

Please provide me details that how can i get any control which reslove location id through city name or get all location ids of cities
thanks in advance


Milan Negovan
on December 23, 2008

Once you sign up for a free developer account with weather.com, you can query their web service for city names.

In the meantime, feel free to use my online tool.

Also, I don't believe there's such a thing as a list of all location IDs.


jerryi
on January 23, 2009

When I run the Weather Control Test in a project by itself, it works fine. However, my website uses Masterpages and I don't know how to use the required Page values (Inherits, codebehind) needed for the Weather Control along with my required values for my webpage/masterpage existing values for these. I'm new to ASP.NET and hope I'm making sense.


Tom
on May 28, 2009

I wish that you could make a VB version of this control ... please please please ... :)


james
on June 01, 2009

Is there any place that documents what the possiblities of data being returned? Like - Container.ConditionDescription can return "Cloudy" or "Partly Cloudy" what else? Trying to plan real estate on web page. thanks


Milan Negovan
on June 02, 2009

James, the only reference of a sorts is the Weather.com SDK. Ultimately, all this data comes from them.


Charles
on July 07, 2009

The sample site at http://www.aspnetresources.com/weathertest.aspx appears to not be working as well as some sites I have used this control on. I suspect that weather.com has modified their XML a bit, breaking this control. Anyone else having this problem?


Charles
on July 07, 2009

I spoke too quick and found the solution on my own. The following line in the WeatherData.cs:

string connectionString = string.Format ("http://xoap.weather.com/weather/local/{0}?cc=*&prod=xoap2&par={1}&key={2}",

needs to be modified to:

string connectionString = string.Format ("http://xoap.weather.com/weather/local/{0}?cc=*&link=xoap&prod=xoap&par={1}&key={2}",

By making that change and rebuilding the DLL in Visual C# Express Edition, I was able to get it fixed.


Milan Negovan
on July 07, 2009

Thank you for heads-up. It would be strange of weather.com to modify their API without backward compatibility or even a notification to other developers.


Mark B.
on July 08, 2009

I was wondering what was going on. Thanks for the help.


Mark B.
on July 08, 2009

The only thing I change is I remove the border='0' attributes from the images and recompile. This allows it to validate XHTML 1.0 Strict.


Tom W
on July 09, 2009

That was a shocker. This weather feed is one of the most popular elements of our web. When it failed two days ago, there was plenty of concern all around. I've just substituted the new DLL (dated 7/7/09) for the old one, and all is well.


Milan Negovan
on July 09, 2009

Folks, I've posted a brief follow-up.


Matthjew Brown
on July 20, 2009

Can someone send me the new DLL?


Milan Negovan
on July 20, 2009

Matthew, please see this.