Asp.net does not use templates to generate static pages

Source: Internet
Author: User
1 Using System;
2 Using System. collections;
3 Using System. componentmodel;
4 Using System. Data;
5 Using System. drawing;
6 Using System. Web;
7 Using System. Web. sessionstate;
8 Using System. Web. UI;
9 Using System. Web. UI. webcontrols;
10 Using System. Web. UI. htmlcontrols;
11
12 Namespace Webapplication2
13 {
14 /**/ /// <Summary>
15///Abstract description of webform1.
16/// </Summary>
17 Public   Class Webform1: system. Web. UI. Page
18 {
19 Protected System. Web. UI. webcontrols. Button button1;
20 Protected System. Web. UI. webcontrols. Label label1;
21
22 Private   Void Page_load ( Object Sender, system. eventargs E)
23 {
24//Place users hereCodeTo initialize the page
25}
26
27 Code generated by web Form Designer # Region Code generated by web Form Designer
28 Override   Protected   Void Oninit (eventargs E)
29 {
30 //
31 // Codegen: This call is required by the ASP. NET web form designer.
32 //
33 Initializecomponent ();
34 Base . Oninit (E );
35 }
36
37 /**/ /// <Summary>
38///The designer supports the required methods-do not use the code editor to modify
39///The content of this method.
40/// </Summary>
41 Private   Void Initializecomponent ()
42 {
43 This . Button1.click + =   New System. eventhandler ( This . Button#click );
44 This . Load + =   New System. eventhandler ( This . Page_load );
45
46 }
47 # Endregion
48
49 Private   Void Button#click ( Object Sender, system. eventargs E)
50 {
51 String URL = " Http://www.sina.com.cn " ;
52 System. net. webrequest wreq = System. net. webrequest. Create (URL );
53 System. net. webresponse wresp = Wreq. getresponse ();
54 System. Io. Stream respstream = Wresp. getresponsestream ();
55 System. Io. streamreader Reader =   New System. Io. streamreader (respstream, system. Text. encoding. getencoding ( " Gb2312 " ));
56
57 Label1.text = Reader. readtoend ();
58 }
59 }
60 }
61

Related Article

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.