Differences between ASP. NET and ASP

Source: Internet
Author: User
Most people may have different understandings about ASP. NET. So what is the relationship between ASP. NET and ASP? Let's take a look at the following example. This code is used to click the submit button of the user registration information module to save the data submitted by the user to the database.

Public void onsubmit (Object sender, eventargs E)
{
If (page. isvalid)
{
// Data warehouse receiving
Try
{
Bbsuser myuser = new bbsuser ();
If (! Myuser. getuser (txtusername. Text ))
{
Myuser. createuser (bbsuser. createtype. Create, txtusername. Text, txtpassword. Text,
Txtemail. Text, txthomepage. Text ,"");
}
}
Catch (exception exp)
{
# If debug
Response. Write ("exception:" + exp. Message );
Return;
# Endif // debug
Server. Transfer ("error. aspx ");
}
}

How is it different from ASP that you used to use? In the code, you can't see the data warehouse receiving, but all the data is encapsulated into the createuser method of the bbsuser class. Maybe you can say that ASP is okay. Isn't it enough to create a function or process? Yes, indeed, ASP. NET can also directly make it into a process and then call it, but if that is the case, it will be a little more than ASP. Let's start from scratch.
The biggest difference between ASP. NET and ASP is the conversion of programming thinking, not just the enhancement of functions. ASP uses HTML, a mix of scripting languages such as vbs and JS, and those scripting languages are weak-type and Structure-oriented programming languages, rather than object-oriented, this obviously produces the following problems:
1. Code logic is chaotic and difficult to manage: Because ASP is a mixed HTML programming language, it is hard to see the logic relationship of the code, and as the complexity of the Program increases, it makes code management very difficult, and even exceeds the management capability that a programmer can achieve, resulting in errors or such problems.
2. Poor code reusability: Because the code is structured-oriented and mixed with HTML, you may need to modify the page prototype and the entire program, not to mention code reuse.
3. potential errors caused by weak data types: although it is easier to use a weak data type programming language, the chance of errors is far from worth the candle.
The above is the weakness of the language itself. asp also has problems in terms of functions. The first is that the functions are too weak, and some underlying operations can only be done through components. This is far inferior to PHP/JSP, the second is the lack of complete Error Correction/debugging functions, which is similar to ASP/PHP/JSP. So what are the improvements to ASP. NET?
ASP. net is free from the disadvantages of ASP's scripting language. Theoretically, any programming language, including C ++, VB, and JS, can be used. Of course, the most suitable programming language is ms. net frmaework specifically released C (read C sharp), it can be seen as a mix of VC and Java, although Ms speak C # kernel more like VC, but I still think it is more like Java. First, it is an object-oriented programming language, rather than a script, so it has all the features of object-oriented programming language, such as encapsulation, inheritance, polymorphism, etc, this solves the vulnerabilities of ASP just mentioned. Encapsulation makes the code logic clear, easy to manage, and applied to ASP. net can separate the business logic from the HTML page, so no matter how the page prototype changes, the business logic Code does not need to be modified. Inheritance and polymorphism greatly improve the reusability of the Code, you can inherit existing objects to maximize your previous investment. C # provides a complete debugging/error correction system like C ++ and Java.
By the way, this tutorial is not ASP.. net. net, C #, and object-oriented programming have a certain understanding, if not, please read the relevant articles or tutorials.

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.