Recommended: Simple WEB development specifications 1. Page design part 1.img control alt: All display images must have text descriptions that can briefly describe the content of the image. 2. Input control maxlength: All INPUT controls need to formulate maxlength attribute, and the default value is the length of the corresponding field in the database.
In previous articles we recognized that ASP is part of a complete operating system. But why is ASP different from previous versions of ASP? What is the difference between them? If you're just running some pages or applications, you probably won't notice their previous differences at all.Once you open the ASP SDK or the help file, you will find that this new product is almost nothing like the previous version.
Of course, there is no need to panic, we will look at some of the main differences in the next step. Let's first look at why Microsoft thinks we need a new version of ASP and what it can help us do. As a developer, we also need to know what new features it has to help us build our sites and applications.
We really need a new ASP! ?
Microsoft's motivation for developing ASP has been discussed in the previous article. ASP has been a huge success, why do we need a new version! ? We can consider the following four points:
Today's ASP can only be written in non-structural languages, such as VBscript and JScript (if you use other languages, you need a separate interpreter). And when the ASP is first executed, it parses and stores the code in the cache. The limitation is that it does not allow the use of other structural languages such as VB and C, thus limiting their superiority. And ASP truly provides a mid-level language execution structure, allowing the use of various languages.
Using HTML, text, and objects to mix ASP is easy to build a large page. But it's hard to reuse this code unless you put some code in an include file. This is not the best solution. In many occasions, developing a network application requires extensive professional skills, such as when you write programs, others do artists, and some people design web content. If you just use ASP, it is difficult to connect these people to accomplish the same thing. But ASP really allows separate code to coexist with content.
In previous versions of ASP, you had to write code for almost everything. To keep the data in the form, write the code. To confirm the data written by the user, write the code. To send some simple data, write code. A real component mode is introduced in ASP. Through this server-side control and event triggering, we seem to be operating FORM in VB. The new component control in this ASP is declarative (that is, if you want to use these component controls to do something, you just need to declare it, and don't worry about the others, haha, don't you think it's a bit stupid?!?), so you actually only need to write very little code. In fact, in many cases, you don't have to write any code at all.
The outside world is changing all the time, and a considerable proportion of users have access to your site through Internet devices, such as WAP mobile phones, PDAs, set-top boxes, and others. Perhaps in the near future, more users will use these Internet users than PCs. This means we may have to do more on the server to adapt to different devices. We also have to use different formats to output, such as WML. At the same time, new interconnected devices and commercial applications also need to have the ability to send or read WML from network applications. Now using ASP to do this requires you to use an XML parser and use XML to convert data. And ASP network services will use the pages you make in a simpler way to adapt to different devices.
In addition to the above, the rapid development of the distribution is that applications also need to be developed faster, more modular, more reusable, easier to operate, and more platforms to support it. New standards like 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, and ASP can adapt to the above requirements and can restart the application in the event of errors and buffer overflows.
Therefore, in order to adapt to these needs, ASP has patched the basics and even the development environment. Visual Studio 7.0 will support ASP applications (including ASP and ASP), although only a few tools can now obtain 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#. Pay special attention to the third language, which is not too far away from us when it is popular.
How does ASP make your life easier?
The biggest challenge for today’s WEB programmers is changing browser compatibility and their ever-elevated complexity. While ensuring that the page can work under all popular browsers, you must try to use the latest attributes of each browser to create more interactive pages. This is simply a nightmare.
What's even more terrifying is to build different web pages for different user devices. Of course, it is impossible to create an equally high level of page on WAP phones and traditional browsers, because due to bandwidth reasons, many WAP phones can only display 12 words and 3 lines of text information at a time.
The easiest solution is to dynamically generate different outputs for different users, or write multiple pages for different users. The second method is not efficient, and I think most developers will choose the first method. But this means that every click of the user will make the server judge what should be displayed to the user.
If all this is possible, why not automate these processes! ? To end this, ASP introduced a new concept of service control, which encapsulates some common tasks and provides a clear programming module. They also help manage different user types.
Server-side HTML control has reduced our code a lot
ASP has provided the ability to execute components on a server that 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 attribute: runat=server (We have also seen this in ASP)
Any HTML elements in the page can be marked using this method, and ASP will execute these elements on the server and produce different code for different users.
This concept of having HTML elements execute on the server for the first time seems a bit strange, but when you find that it becomes fully functional on this page, what else do you have to think about.
The problem of keeping the status
One of the most annoying issues when we build interactive pages and applications is to process data coming from the client and then keep that data under control. A core goal of ASP is to simplify this process. This will not cause any confusion for programmers and will work fine on most browsers.
Let's take a look at the following code first. This code creates a simple page for users to enter the computer's name and choose the operating system. OK, it's not an annoying or exciting example in itself, but it reflects some of the things we do often. After this page is submitted, use the request.form set to get the corresponding data, and then display them with request.write.
<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>
Share: Create a simple chat room with ASP After a stage of Asp learning, we will build a simplest chat room based on the content we have learned. Although it is very simple, you can master the basic process of establishing a chat room through it and continuously improve its functions. The following are the main steps: