Asp. The code behind technology in net

Source: Internet
Author: User
Tags html page microsoft frontpage

A Introduction to Code behind

Code behind is what is called coding separation, and since Microsoft launched ASP.net, code behind is a hot topic. In a generic asp.net file, the Code Behind mainly uses two files to create a asp.net page, one is the design file, generally with. aspx or. ascx as the extension, and the other is the program code file, generally with. vb or. cs as extension, its programming language is mainly vb.net or C #。

Two Code behind advantages

The user who has programmed the ASP has known that the ASP program is a mix of interface design and programming. Therefore, when the program designer to modify the application interface layout, it is often necessary to change a large number of interface-independent code, for a small program, the workload is not very large, if the code for a large number of programs, is a workload is not small things. and code behind the interface design and programming code to separate files, for the re-use of code, program debugging and maintenance are revolutionary. Another point is that when you publish your site, you can use this technology to effectively protect your code. This is an improvement on the security of the program. The Code behind technology appears a bit like the past VB or Delphi appears the same. That's why he became a hot topic as soon as he appeared. Below we use a complete example to specify the characteristics of the code behind technology.

Three Introduction to Examples

The operating environment for this example is the Windows Prefessional version and the. Net FrameWork SDK Beat 2. The programming language is C #, whose primary function is to send e-mail. The program is divided into two parts, the interface code to send e-mail to the mail.aspx file to save, and send the program is Send.cs file to save.

Four Concrete implementation Steps

1). Create a new HTML page

You can use Microsoft's fontpage to design the entire layout of your page. All of your options are designed into this page. The specific interface is shown below:

The

Names this HTML file as send.htm. The specific code is as follows:

<meta http-equiv= "Content-type" content= "text/html; charset=gb2312"
<meta name= "generator" content= "Microsoft FrontPage 4.0"
<meta name= "ProgId" content= "FrontPage . Editor.document
<title>new Page 1</title>
<body>
<form>
<table border= "1" width= "100%"
<tr>
<t D width= "100%" colspan= "2" > Please fill in the following: </td>
</tr>
<tr>
<td width= "35%" > Name </t D>
<td width= "65%" ><input type= "text" name= "name" size= "
</td>
</TR>
<tr>
<td width= "35%" > E-mail address </td>
<td width= "65%" ><input type= "text" Name= "Ema    Il "size="
</td>
</tr>
<tr>
<td width= "35%" > Content </td>
<TD width= "65%"
<textaRea rows= "7" name= "message" cols= ""
</textarea>
</td>
</tr>
<tr>    
<td width= "100%" colspan= "2"
<input type= "Submit" value= "Submit" Name= "B1" ></TD>
</tr>
</table>
</form>
<p></p>
</body>

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.