What is the difference between ASP + and ASP?

zhaozj2021-02-08  228

What is the difference between ASP and ASP: http://www.aspcn.com The original text from http://www.asptoday.com See the translation of the headache, and this article is still very long, this article is very It will be written as soon as possible for a few days, but run to the body, or lose. . . . . . .

In the previous article, we recognize that ASP is part of a complete operating system. But why is ASP different from previous version of ASP? What is the difference between them? If you are just running some pages or applications, you may not notice their previous differences at all.

Once you open the ASP SDK or help file, you will find that this new product is almost no bit like the previous version.

Of course, we don't have to panic. Let's take a look at some main points. Let's take a look at why Microsoft will think that we need a new version of ASP, which can help us do. As a developer, we also have to know which new features are to help us establish site and application.

We really need a new ASP! ?

Microsoft has developed ASP motivation. We have discussed in the previous article. ASP has made great success, why do we need a new version! ? We can consider it from below:

The current ASP can only be written in a non-structural language, such as VBScript and JScript (if you need a separate interpreter) if other languages. Moreover, when the ASP is executed for the first time, it resolves and stores these code in Cache, which is not allowed to use other structural languages ​​such as VB and C , limiting their superiority. ASP truly provides the middle language execution structure, allowing the use of various languages. Use HTML, text, and object-mixed ASPs easy to create a large page. But it is difficult to reuse these code unless you put some code in an Include file. This is not the best solution. In a lot of occasions, developing a network application requires a wide range of professional skills, such as you write the program, others do the art, and some people design web pages, if only ASP is difficult to connect these people to complete The same thing. However, ASP actually allows individual code to coexist with content.

In the ASP in previous versions, you must write code for almost everything. In order to keep the data in the form, write the code. In order to confirm the data written in the user, write the code. In order to send some simple data, write code. In the ASP , a real component mode is introduced. Through this server-side control and event trigger, we seem to feel like "form" in operation VB. This ASP new component control is the nature of the declaration ( That is, if you want to use these component controls to do something, you only need to declare it, don't worry, haha, if you think some fools ?!?), You actually need to write Very few code. In fact, in many cases, you don't have to write any code at all. The world is changing, and there is a considerable proportion of users to access your site through "Internet equipment". Say WAP mobile phones, PDAs, top boxes, and others, maybe in the near future, users who use these Internet users more than using PCs. This means that we may have to do more in the server to fit in different devices. We have to use different formats, such as WML. At the same time, new internet equipment and commercial applications also need to be able to send or read WML from web applications. Now use ASP to do this, you need to use XML parsers to use XML conversion data. The ASP network service will use the simple manner to use the page you can adapt to different devices. In addition to these, rapidly developing distributions are applications that need to be developed more quickly, more modular, repeated utilization, easier to operate, so more platform support. New standards such as SOAP (Simple Object Access Protocol) and the commercial needs of B2B require a new technology to adapt to different systems. Web applications and websites need to provide a more powerful upgradeable service, ASP can adapt to the above requirements, and can restart the application when an error occurs, buffer overflows.

Therefore, in order to adapt to these needs, ASP has been repaired based on the basis even the development environment. Visual Studio 7.0 will be completed for ASP applications (including ASP and ASP ), although there are only few tools now get their support. This rich, component mode program development module is designed to be quite friendly, and it also supports all Visual Studio languages, including VB, C , and C #, especially pay attention to the third language, its popular days are not too far away .

How does ASP make your life simpler?

The biggest challenge for today's web programmers is to changing the compatibility of the browser, and their constant upgrade. In the guaranteed page, you can use the latest properties of each browser while working at all popular browsers, which is simply a nightmare.

More terrible is to establish different web pages for different user equipment. Of course, it is impossible to establish equivalent levels on WAP phones and traditional browsers, because due to bandwidth, only 12 words 3 lines of text information can only be displayed in many WAP phones.

A simplest solution is to dynamically generate different outputs for different users, or write multiple pages for different users. The second method is not efficient, I think most developers will choose the first method. But this means that every click of the user will make the server to determine what should be displayed to the user.

If all this is possible, why not automate these processes! ? In order to end this, ASP introduces a new service control concept, which encapsulates some common tasks, providing a clear programming module. They also help manage different user types. Server-side HTML control makes us reduce a lot of code

The ASP has provided a capacity to execute components on the server, which can generate some code to return to the user. ASP inherits this concept through service control. The need to convert HTML elements to service control is just an additional property: runat = "server" (this we have seen in ASP)

Any HTML element in the page can be marked with this method, and ASP will perform these elements on the server and produce different code for different users.

This concept that allows HTML elements to execute on the server. The first time it seems to be somewhat strange, but when you find it completely functionalized in this page, what else do you want to do.

Keep state problem

One of the most annoying questions when we build interactive pages and applications is to process data from the client and then keep these data to control. A core objective of ASP is to simplify this process. This will not give any confusion to the programmer and work properly on most browsers.

Let's take a look at the code below. This code has created a simple page to allow users to enter the name of the computer and select the operating system. OK, it is not a very annoying example, but it reflects some things we often do. When this page is submitted, use the request.form set to obtain the corresponding data and then display them with Request.write.

<%

IF LEN ("SELOPSYS")> 0 THEN

Stropsys = Request.form ("SELOPSYS")

Strname = Request.form ("txtname")

Response.write "You SELECTED '" & stropsys _

& "'for machine'" & strname & "'."

END IF

%>

Machine Name:

Operating system:

Although this is an ASP file (the suffix name is .asp is not .aspx, but if we change its file suffix to .aspx, it can also work normally in ASP . Remember, these two systems can be on a machine Very good coexistence, this suffix name is just judging, this parsing is ASP to do, or asp is made. In the following snapshot, we see the results executed in IE5, when the user clicks this submission button, will put data Pass the server, this page will be refreshed, and the results we choose. Of course, we can put these data into data, or do some other things, this is simple, we just let it display come out.

The problem with this page is that it cannot keep the state. In other words, it can only return to the default value, and the user has to re-enter the data when re-this page. As shown below:

In order to achieve the above requirements, we have to add some data in this code, as follows:

Machine Name:

Value = "<% = Server.htmlencode (Request (" txtname "))%>">

Operating system:

Take a look at the code above, so many if ..... THEN, I am very annoying (actually in the ASP, this can be simplified, maybe the original author wants to highlight the ASP more concise, deliberately write this code very Long) The following figure is the result of our modified code:

Automatic maintenance status control

So how the ASP is handled in this problem! ? The following code allows us to see the advantages of ASP give us a change. Let's take a closer look at the code below. Some elements in this page add the properties of Runat = "Server". When ASP sees these elements, it will execute these code on the server and produce the correct output:

Machine Name:

Operating system:

Now you can see how ASP is simpler than ASP. The following is the result of the execution, and there is no difference in ASP:

How is the server work? ! ?

How do these data get it! ? The key here is Runat = "Server" properties. In order to have a sense of understanding, let's take a look at this html source code:

You SELECTED 'Windows 98' for machine 'tizzy'.

Machine Name:

Operating system:

We use the code below in ASP creation :

...

When this page is executed by ASP , the code output to the browser is:

...

You now see ASP automatically add Action and Method methods, so this page will be submitted in a POST mode. ASP also adds a unique value ID and Name value to Form, and these we have not specified (but you can also specify, you specify as you specify)

If you are adding the "get" attribute, this form will be received in queryString, just like the previous ASP, this automatic state will not work.

In this page we use the code below to establish a text item:

The result in the browser is:

You can also see ASP automatically add the value attribute and its value. At the same time, the Name property is added, which is the same as the value of the ID.

Here is

ASP because there is a selected attribute in