Partilhar via


Weather Forecast ASP.NET user control

I am posting source code for the weather report control that I am using on my Web site. It looks like this:

Weather forecast control preview

It fetches weather forecast data from a free XML Web service provided by US National Oceanic and Atmospheric Administration (NOAA). There is a lot of data there (wind speed and direction, humidity, precipitation, etc). I only used some of it. I believe the data is for US only so it won't work for every geographical location.

There is no copyright of any kind, feel free to use the code any way you see fit. If you don't like the code or markup, don't shoot me, I am only a C++ developer :-)

Updated version: https://blogs.msdn.com/mikhailarkhipov/archive/2006/06/12/628540.aspx

Comments

  • Anonymous
    August 12, 2004
    Pretty cool stuff! Now all you need is to hook it up to USGS database for automatically determining lat/long from the city name:

    http://geonames.usgs.gov/pls/gnis/web_query.gnis_web_query_form

  • Anonymous
    August 13, 2004
    Cool stuff indeed - I wish I could put one of your weather images to show it!

  • Anonymous
    August 13, 2004
    In fact, icons are provided by NOAA as part of their Web service (very nice of them!).

  • Anonymous
    August 31, 2004
    I wanted to use this on a VB ASP.Net applications, but I can't just include the files, since it appears you can't mix VB and C# in the same project. I wanted to compile it into an assembly, but it doesn't look like Web Control libraries support ASCX user controls - just .CS classes. Any thoughts? Thanks!

  • Anonymous
    April 14, 2005
    Just wanted to add another comment thanking you for your code and your benevolence to give it away. It's too bad NOAA doesn't provide real time weather data. They provide XML feeds for all of their weather stations (http://weather.gov/data/current_obs/) but many of them don't even have Latitude/Longitude coordinates -- what's the point of that? Anyway, this code gets me one step closer to a fully functional weather service.

    Thanks,
    Kevin Grigorenko
    http://www.myplaceonline.com/

  • Anonymous
    July 07, 2005
    Well done! Thanks for sharing this.

  • Anonymous
    September 04, 2005
    I need to use ur control how do i use it i have downloaded ur zip but help me in using the tool pls

  • Anonymous
    September 07, 2005
    Hi, I was wondering if there is something more to this. I have added your code and control to my solution. I dragged the control onto my form and made sure the control had the parameters you show in your README file but when I run the page nothing shows up. Any help is much appreciated. Also, thanks for the code!!!

  • Anonymous
    September 07, 2005
    I am getting an Exception thrown in the ParseWeatherXML method. I do have a string value passed into this method but the exception is thrown anyway. Any help?

  • Anonymous
    October 15, 2005
    The control stopped working on my own Web site as well. I guess NOAA might have changed something in their XML data. I'll try to debug when I get some spare time.

  • Anonymous
    December 13, 2005
    I am posting this link here to help those who dont have this user control working atm. Maybe you can update the stream and such and that may fix your issues with this.

    http://www.nws.noaa.gov/xml/index.php

  • Anonymous
    February 23, 2006
    could u u tell me how i can use weather in my asp.net c# application.

  • Anonymous
    March 06, 2006
    The comment has been removed

  • Anonymous
    March 08, 2006
    Can someone clarify - does NDFD provide only FUTURE data or can I fetch historical weather data? What I'm really looking for in my application is ability to get historical data from days/weeks ago.

  • Anonymous
    March 31, 2006
    hi,
    Excellent stuff ..!
    i would like to use this..!
    But i just want to get wehter forecast information of gulf contries...So there is any webservice URL which give us weather forecast information of gulf coutries(whole world)...
    any body having any info regarding this...plz reply me...

    Thank u
    Deepak

  • Anonymous
    April 21, 2006
    The comment has been removed

  • Anonymous
    May 09, 2006
    I had this issue also.  I searched the entire project for the text "ndfdXMLserver.php" and found two lines in two documents that were pointing to URL's that have apparently moved.  Copy the URL "http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php" and replace the URL from the results you find from your search with the one copied.
    That worked for me, but now the issue is the error "System.Net.WebException: The underlying connection was closed: The server committed an HTTP protocol violation." which was posted above with no resolution.  Microsoft explains this error is the result of increased security in the machine.config file.  The recommend adding a statement in there to remedy it, but that did not work for me.

  • Anonymous
    May 10, 2006
    I can't resist appreciating the owners of this blog. Good information. Well Done.

    Bert Linert
    http://www.humiditycontrolcenter.com

  • Anonymous
    June 08, 2006
    The comment has been removed

  • Anonymous
    June 12, 2006
    Updated version: http://blogs.msdn.com/mikhailarkhipov/archive/2006/06/12/628540.aspx

  • Anonymous
    January 20, 2008
    PingBack from http://websitescripts.247blogging.info/mikhail-arkhipov-msfts-weblog-weather-forecast-aspnet-user-control/

  • Anonymous
    March 26, 2008
    PingBack from http://www.perceptivepetal.com/wordpress/?p=130

  • Anonymous
    March 27, 2008
    PingBack from http://www.perceptivepetal.com/wordpress/?p=134