The weather forecast Web Service is used ,,,

Source: Internet
Author: User

Add web reference on the Web --> http://www.webxml.com.cn/WebServices/WeatherWebService.asmx --> go --> Add reference ,,,

Create a default6 page:

CS:

Using system;
Using system. Collections. Generic;
Using system. LINQ;
Using system. Web;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Threading;
Using cn.com. webxml. WWW;
 
Public partial class default6: system. Web. UI. Page
{


Protected void page_load (Object sender, eventargs E)
{

}
Protected void button#click (Object sender, eventargs E)
{
Weatherwebservice d = new weatherwebservice ();
String [] STR = D. getweatherbycityname (this. textbox1.text );
Foreach (string s in Str)
{
Response. Write (S + "<br> ");
}
}
}

Page:

<% @ Page Language = "C #" autoeventwireup = "true" codefile = "default6.aspx. cs" inherits = "default6" %>

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> </title>
</Head>
<Body>
<Form ID = "form1" runat = "server">
<Div>
<Asp: Label id = "label1" runat = "server" text = "enter a city"> </ASP: Label>
<Asp: textbox id = "textbox1" runat = "server"> </ASP: textbox>

<Asp: localize id = "localize1" runat = "server"> </ASP: localize>
<Asp: button id = "button1" runat = "server" text = "query" onclick = "button#click"/>

</Div>
</Form>
</Body>
</Html>

The getweatherbycityname method returns an array of 22 strings, as follows:

Shandong Province
Qingdao
54857
54857. jpg
20:02:52
-9 ℃/-3 ℃
A snow shower turned cloudy in December 23
Beijing wind 5-6 levels to 3-4 levels
13. gif
1. gif
Today's weather conditions: temperature:-2 ℃; wind direction/wind power: North Wind level 3; humidity: 68%; air quality: Excellent; ultraviolet intensity: weakest
Dressing Index: The weather is cold, it is recommended to wear thick down jackets, fur coats, thick sweaters and other winter clothing. For the elderly and the weak, pay special attention to keeping warm and antifreeze. Allergy index: weather conditions are extremely difficult to induce allergies, snowfall, heavy wind power, out to pay attention to wind and warm. Exercise index: If snowfall occurs, we recommend that you exercise low intensity indoors. if you exercise outdoors, select the proper exercise and keep warm. Car Wash Index: it is not suitable for car wash. There will be snow in the next 24 hours. If you wash your car during this period, the snow water and the mud on the road may dirty your car again. Air Drying index: snowfall is not suitable for air drying. If you need to dry out, prepare sufficient room in the room. Travel index: when the weather is a little cold, snow may fall and the wind is windy, which may affect your trip. Not suitable for traveling. Road Condition Index: snow may occur. Due to the cold weather, ice may be accumulated on some roads. Please avoid traveling as much as possible. If you need to drive, please be vigilant. Comfort level index: snow, cold weather, strong wind power, not very comfortable, please pay attention to add clothes. Air Pollution Index: meteorological conditions are very conducive to air pollutant dilution, diffusion and removal, and can be normally performed outdoors. UV Index: weather with weak ultraviolet radiation, no special protection required. If you are outdoors for a long time, it is recommended that you apply sunscreen between 8-12 SPF skin care products.
-4 ℃/-2 ℃
December 24 clear to cloudy
South Wind 3-4 to southeast wind 3-4
0. gif
1. gif
-6 ℃/-1 ℃
Cloudy to clear in December 25
Northeast wind 4-5
1. gif
0. gif
Qingdao is located in the southern part of Shandong Peninsula. It is located in the east longitude 119 ° to 121 ° 00 ', north latitude 35 ° to 37 ° 09', east and south are on the Yellow Sea, Northeast China is adjacent to Yantai City, the West is connected to Weifang city, while the southwest is adjacent to Rizhao City. The city's total area is east, south on the Yellow Sea, Northeast and Yantai City adjacent, west and Weifang city connected, southwest and Rizhao city border. Area: Total area: 10654.1 square kilometers. Population: more than 7 million. Qingdao has a distinctive climate, that is, the four seasons are distinct, short summer and long winter; no hot summer in summer, less cold in winter; moderate precipitation, sufficient heat; Multi fog in spring and summer, and great spring breeze in winter. Qingdao is short in summer than in the Mainland, with an average of only 80 days a year. The average temperature in summer is 23 degrees Celsius, and the average temperature in August is 25.1 degrees Celsius. Due to the influence of the ocean, the weather is cooler and people take a summer vacation, the best season for recuperation and swimming. Qingdao has experienced vicissitudes in modern times and has rich cultural tourism landscape. According to the distribution of scenic spots and cultural connotation, it can be divided into four distinctive regions: the Western Old City (the western modern city style) eastern New Area (modern international city style), urban hinterland (jiandong Folk Culture style), suburb (historical cultural relics and monuments style ). Visit Qingdao to enjoy a pleasant climate and beautiful scenery. In addition, it can produce deep thinking and inspiration in the crystallization of Chinese and foreign cultures, which has a high tourism value. Landscape: Laoshan, badanguan, zhanqiao, and Wusi square.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.