📄 default.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Core;
using System.IO;
using System.Net;
//该源码下载自www.51aspx.com(51aspx.com)
public partial class _Default : System.Web.UI.Page
{
/// <summary>
/// 本作品是小高同志的原创
/// 原创作品首发于51aspx,转载请注明
/// 注意:在你确认能上网的情况下你可以将Page_Load里面的代码给注释掉哈
/// </summary>
ValidateOnline vi = new ValidateOnline();
GetName GN = new GetName();
protected void Page_Load(object sender, EventArgs e)
{
//因为本程序必须要能够在你的电脑上网的情况下才能正常运行,所以写了下面的代码来判断你的电脑能否上网
if (vi.IsValidateOnline())
{
;
}
else
{
Response.Write("<script>alert('你现在不能连接外网,所以该程序不能正常执行!!!')</script>");
Capital.Enabled = false;
City.Enabled = false;
}
}
//现在向我们的"老板提交数据咯"
//运行完了看看你的浏览器的标题栏哦
protected void BtnList_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);//线程暂停3秒
String CityName = City.SelectedValue.ToString();
Label1.Text = "";
if (CityName.Length == 0)
{
Label1.Text = "对不起,你没有选择任何的数据,请选择数据后再进行操作";
}
else
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://weather.news.qq.com/inc/07_dc" + CityName + ".htm");
request.Method = "Get";
request.ContentType = "application/x-www-form-urlencoded";
WebResponse response = request.GetResponse();
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s, System.Text.Encoding.GetEncoding("GB2312"));
string html = sr.ReadToEnd();
s.Close();
sr.Close();
Label1.Text = html;//.Replace("/images/", "http://mat1.qq.com/weather/images/");
Page.Title =GN.Name1(Capital.SelectedValue.ToString()) + GN.Name( CityName)+"的天气情况";
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -