Differences in the previous article have discussed Microsoft's primary motivation for designing and developing asp+. ASP very successful, why
You want a new version? There are 4 questions to consider:
Currently, ASP scripts are written primarily in basic non-typed languages, such as VBScript and JScript (unless you install a
An independent language interpreter). Although the ASP does decompose and cache the first time the page code executes, this limitation results in even
When you have an advantage, you can't use those strongly-typed languages, such as visual Basic and C + +. and asp+ for
WEB applications provide a truly language-enforced framework for execution.
It is also easy to create large ASP pages that contain a long list of code, HTML, text, and object declarations mixed together.
It is difficult to reuse this code unless you put it in a separate ' include ' file, which is not a good idea.
In many environments, developing a Web application requires a variety of professionals, such as requiring programmers to write code, requiring
Designers to make HTML look beautiful. Let the code and content mingle in a file that both sides need to manipulate to make them
It's hard to work together. And asp+ provides a true separation of code and content.
In previous versions of ASP, most things were done by writing code. Do you want to maintain the status of the form field? Write code. Think
Do you want to confirm the data entered by the customer? Write code. Do you want to send out some simple data values? Write code. Do you want to cache page area optimization performance?
Write code. And asp+ events that are based on server-based control and conceptually work with visual Basic forms
The driver run example introduces a real component model. New asp+ server controls are declarative (they need to do something
So you can write less code, in fact, in most cases you don't have to write any code at all.
The world is changing. Via ' Internet device ' such as mobile phones, PDAs, TV set-top boxes, game consoles, or
The percentage of users who visit your site will soon exceed those who use PCs and traditional browsers. That means we're not going to
Do more work on the server to make our Web pages compatible with these different devices. We have to be in a whole new format
Create output, such as wireless Markup Language (WML). Also, in addition to creating WML for running, the new internet
Devices and business applications also require the ability to send and receive XML data from a Web application. Now use ASP to do this requires you to hand
Use XML decomposition to transform data from an XML plan, or to convert data to XML. asp+ Web Services to tailor pages to fit
A particular device becomes simple.
In addition, the rapidly changing nature of distributed applications requires faster development, more modular, more reusable, and easier
Expanded and broader platform support. New standards such as Simple Object Access protocol, easy access Protocol
(SOAP), new business requirements, such as business-to-business (business-to-business) Data interchange, require new technology to produce output and
Other system communications. Web applications and Web sites also require more flexible and scalable services, which tend to be asp+ by
Active monitoring and automatic restart of application failures, memory release, etc. are provided.
Therefore, to meet these requirements, the ASP must make comprehensive changes to become a new programming environment. Despite the current
There are few tools available for this, and Visual Studio 7.0 provides full support for creating asp+ applications that are simple, including
asp+ pages and asp+ services). A rich, component-based, event-driven programming model is deliberately designed as "tool-friendly",
This support is for all visual Studio languages, including VB, C + +, and C #. are available. And you can be sure that the third party
Tool makers will not lag too much behind.
The biggest challenge facing Web developers today is the compatibility of browsers and the complexity of the pages they are creating
continue to increase. To create more interactive pages, take advantage of the latest features of the various browsers, and also make sure that the page
Working on all possible browsers is a nightmare that can't be haunted.
Of course, using these new internet devices, which are emerging or already in use, can make things worse. In particular, to create
Web pages to provide the same user-level compatibility for mobile phones and traditional browser customers is also possible. Only 3 lines of runes can be displayed
The mobile phone of this course has to limit creativity and user interactivity.
An obvious solution is to create a dynamically positioned output for each particular customer? or create multiple versions of the same site, each
A version of a customer. The second approach is not tempting, and many people tend to be the first. But that means it comes from every user.
Each knock requires some server-side processing to indicate which output to create.
If so, why not let this process be automated? Here, Asp+ introduces the concept of server control, which contains
Common tasks and provide a clear programming model. They also help address the positioning of various types of customers.
ASP has provided the opportunity to run components on the server, which produce portions of the page that are returned to the user. Asp+ through
Server control extends this concept. All you need to do to convert any HTML element into server control is to add an extra
Properties: runat= "Server".
Any HTML element on a page can be marked in this way, and then asp+ processes the elements on the server and
Produces output that is appropriate for this particular server. In addition, as a by-product, we can also create an extra tip with a special
html〈form〉 the form creation code associated with the control element to maintain state in a round trip to the server. This makes programming
The process is less monotonous and more creative.
The concept of letting HTML elements execute on the server seems a little strange, and you'll find that it adds a whole to the functionality of the page
New level, but also easier to write. What more can a programmer ask for?
The most annoying task when creating Web sites and interactive applications is to manage the values that are passed to the server from HTML form control.
Maintain the values of these controls between page requests. So one of the core purposes of asp+ is to simplify this programming task. This is for programmers
No additional work is designed, and all browsers that support basic HTML are well done.
Look at the next part of the code. Create a simple form with HTML control, and the user can enter the computer name and select the operating system.
This example itself is nothing great, but it represents a fairly common situation, and almost every Web application now
will be used. When the form is submitted to the server, the value that the user selects is extracted from the Request.Form collection and
Display using the Response.Write method:
〈html〉
〈body〉
〈 %
If Len (Request.Form ("Selopsys")) 〉0 Then
Stropsys = Request.Form ("Selopsys")
StrName = Request.Form ("Txtname")
Response.Write "You selected '" & Stropsys _
& "' For Machine '" & StrName & "'."
End If
% 〉
〈form action= "pageone.asp" method= "POST"
Machine Name:
〈input type= "text" Name= "Txtname"
〈p/〉
Operating System:
〈select name= "Selopsys" size= "1"
〈option〉windows 95〈/option〉
〈option〉windows 98〈/option〉
〈option〉windows nt4〈/option〉
〈option〉windows 2000〈/option〉
〈/select〉
〈p/〉
〈input type= "Submit" value= "Submit"
〈/form〉
〈/body〉
〈/html〉
Although this is an ASP page (the file name extension is. asp instead of. aspx), if we change the extension to. aspx,
It works the same under the asp+. Remember that both systems are free to coexist on the same machine, and file extensions are determined by
ASP or asp+ to deal with.
The following figure shows what it looks like in Internet Explorer 5. When the user clicks the Submit button to deliver to the server
Value, the page is reloaded to display the selected value. Of course, in a real application, some values are stored in the database, or
Used to perform some specialized processing. In the example we just show on the page.
One problem is that the page does not maintain its state, in other words, controls the default values that return them. The user wants to use the expression again
Re-enter. As you can see in the following figure.
To avoid this, you need to add some extra code to the page and insert the value into control when the page is reloaded.
For a text box, it's just
[1] [2] Next page