asp.net 不用模板生成静态页面

 1 None.gif using  System;
 2 None.gif using  System.Collections;
 3 None.gif using  System.ComponentModel;
 4 None.gif using  System.Data;
 5 None.gif using  System.Drawing;
 6 None.gif using  System.Web;
 7 None.gif using  System.Web.SessionState;
 8 None.gif using  System.Web.UI;
 9 None.gif using  System.Web.UI.WebControls;
10 None.gif using  System.Web.UI.HtmlControls;
11 None.gif
12 None.gif namespace  WebApplication2
13 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
14ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//// <summary>
15InBlock.gif    /// WebForm1 的摘要说明。
16ExpandedSubBlockEnd.gif    /// </summary>

17InBlock.gif    public class WebForm1 : System.Web.UI.Page
18ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
19InBlock.gif        protected System.Web.UI.WebControls.Button Button1;
20InBlock.gif        protected System.Web.UI.WebControls.Label Label1;
21InBlock.gif    
22InBlock.gif        private void Page_Load(object sender, System.EventArgs e)
23ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
24InBlock.gif            // 在此处放置用户代码以初始化页面
25ExpandedSubBlockEnd.gif        }

26InBlock.gif
27ContractedSubBlock.gifExpandedSubBlockStart.gif        Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
28InBlock.gif        override protected void OnInit(EventArgs e)
29ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
30InBlock.gif            //
31InBlock.gif            // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
32InBlock.gif            //
33InBlock.gif            InitializeComponent();
34InBlock.gif            base.OnInit(e);
35ExpandedSubBlockEnd.gif        }

36InBlock.gif        
37ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
38InBlock.gif        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
39InBlock.gif        /// 此方法的内容。
40ExpandedSubBlockEnd.gif        /// </summary>

41InBlock.gif        private void InitializeComponent()
42ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{    
43InBlock.gif            this.Button1.Click += new System.EventHandler(this.Button1_Click);
44InBlock.gif            this.Load += new System.EventHandler(this.Page_Load);
45InBlock.gif
46ExpandedSubBlockEnd.gif        }

47ExpandedSubBlockEnd.gif        #endregion

48InBlock.gif
49InBlock.gif        private void Button1_Click(object sender, System.EventArgs e)
50ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
51InBlock.gif            string url="http://www.sina.com.cn";
52InBlock.gif            System.Net.WebRequest wReq = System.Net.WebRequest.Create(url);
53InBlock.gif            System.Net.WebResponse wResp =wReq.GetResponse();
54InBlock.gif            System.IO.Stream respStream  = wResp.GetResponseStream();
55InBlock.gif            System.IO.StreamReader reader = new System.IO.StreamReader(respStream, System.Text.Encoding.GetEncoding("gb2312"));
56InBlock.gif
57InBlock.gif            Label1.Text=reader.ReadToEnd();
58ExpandedSubBlockEnd.gif        }

59ExpandedSubBlockEnd.gif    }

60ExpandedBlockEnd.gif}

61 None.gif

转载于:https://www.cnblogs.com/suneryong/archive/2007/04/23/724107.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值