Asp.net 天气预报资料整理 初稿
ASP.NET获取天气预报大致分析有 1到某个网站上分析网站的代码获取;2自己写驱动服务和web服务 第二种水太深不曾涉及。
ASP.NET后台程序获取中央气象台天气预报
1.天气封装成一个实体
2.可以获取当天天气,也可以获取未来五天的天气集合
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;
using System.Collections;
namespace CommonComponents
{
/// <summary>
/// 天气辅助类
/// </summary>
public class TqHelper
{
/// <summary>
/// 获取未来五天天气
/// </summary>
/// <param name="citycode">城市编号(例如:[url]http://www.weather.com.cn/html/weather/101010100.shtml[/url]中的“101010100”就是编号)</param>
/// <returns>未来五天的天气实体集合</returns>
public List<TqInfo> GetFiveDayTqList(string citycode)
{
List<TqInfo> tqInfoList = null;
Hashtable ht = GetTqHash(citycode);
if (ht!=null && ht.Count > 0)
{
tqInfoList = new List<TqInfo>();
for (int i = 1; i <= 5; i++)
&nbs
相关文档:
在C#中
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Services;
using System.Collections.Generic;
using System.Collections;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.Ba ......
1. Web.config中添加:
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
2. 頁面中添加:
<head>
<meta http-equiv="Content-Type" content="charset=utf-8&qu ......
-----------------------------.cs类文件中
当前项目的物理路径嘛:
strPath = this.Server.MapPath(Request.PhysicalApplicationPath);
你要说明什么“类文件”。任何PAGE、CONTROL代码也是在类 ......
这段时间,老大在看了网站后,发现viewstate所产生的一堆乱码,严重影响了我们网站http://www.xbcar.net 西部汽车网的打开速度和搜索引擎的抓取.就给我下了道铁令,三天内必须解决.这下该轮到我头大了,
例如:
input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="dEV4cHJlc3Npb247UmVhZE9ub ......
1. 注册js函数
String scriptString = "<script language=JavaScript>function doClick(){";
scriptString += "for(var index=0;index<myArray.length;index++)";
scriptString += "alert(myArray[index]);}<";
scriptString += "/" + "script>";
ClientScript.RegisterStartupScript(typeof(WebForm2) ......