1、 ASP Foundation. ASP is the combination of Ff1ML code and program code. Now let's learn about ASP.
(1) ASI,. i1ML code and program code in
Unlike ordinary application programs,. asp programs do not need to be compiled. Its control part is written by script language officers such as VBSctip,] avaScript, and its program part is interpreted and executed by the Web, Website production When executing, the script program sends a set of commands to the script interpreter, which translates them into commands that can be executed by the server. AS!, It is not a scripting language in itself. It only provides an environment for running script programs embedded in HTML pages. If the browser asks the web server for the. file, the web server will read the. file first. When it encounters the if tag, it will directly pass the read content to the browser. If it encounters the. tag<% and%>, it will treat the content as a program and then interpret and execute it. Therefore, the difference between ^ ASP and HTML can be summarized as follows: what is written between<% and% is the program code of ^ ASP. The program is interpreted and executed by the Web server and will not be downloaded to the browser. Its code is confidential; The program between<SCRIPT>and</SCRIPT>is the TIM1 code, which can be downloaded to the browser for interpretation and execution. In other words, ASP code marks the challenger in the TIML code through the delimiter (<% and%>). The "% and%" delimiter points out the start and end of the SP code to the web server, which helps the server determine which points of the web page need to be processed before sending it to the user's browser (2) Enter ASP code in the webpage
By adding ASP code to HIML documents, you can create dynamic interactive web pages. ASP code can challenge people wherever you want to display its results in the web page. However, it should be noted that the ASP code used to display information on the user's browser must be between the<BODY>and</BODY marks. The body operation is as follows: (1) Determine the bit basin to insert ASP code, and select<%; (2) Select ASP code and pick up%>in the position of ASP code end point; (3) Save the ASP page. When a user displays a web page containing ASP code on the browser, the web server first sends the HT-ML code used to create the web page to the browser, then processes the ASP code between the ASP delimiters, and replaces the ASP code with the result generated by the code. Then, the result of the ASP code will be returned to the browser as HTML code, and the browser will read all HTML codes and display this page on the user's screen.
2、 Ran Zhan, the target
The function of ASP is realized through the built-in objects of ASP. In object-oriented programming, an object is a set of data and a set of operations defined on the data set. The object is set in a specific chess type. In the object, the customer uses the object's service to access the object's data through a set of methods or two related interfaces. Then the client can call these methods to perform some operation. ActiveX control is the key to building a Web application. The control executes objects that perform tasks in scripts. The Ac liveX control is a file that contains the code to execute a certain task or a group of tasks. Because the control can execute common tasks, programmers do not have to create the code to execute these tasks themselves, but can use the control as a script and a building block of web-based applications. As long as you know how to access the objects provided by the control, even novices can write scripts without knowing how the control works. In short, controls enable you to write powerful scripts without learning programming. Control is the executable code contained in the dynamic link library. dllU or the executable file. exe. It can provide one or more objects and their methods and properties. To use the object provided by the control, you should create an instance provided by the object and assign a variable name to the new instance. ASP provides objects used in scripts. These objects make it easier for users to collect information sent through browser requests, respond to the browser and store user information, so that ASP website developers can get rid of a lot of tedious work. The current ASP version provides a total of five built-in objects, and the following specific learning.
(1) Response object
Response is more like "Response. For the Wshan server, the response is to reply to the file or data requested by the browser. If the browser requests an html file, the web server does not need to execute any program, just download the html file to the browser. However, if the browser requests an S&P file, the web server will interpret and execute the program in the asp file How can some data to be extracted from the line program be transferred to the browser and displayed in the browser? The Buffer property indicates whether to use the flush page extraction. If it is true, the Resporwe content should be written to the human flush area. After the script is processed, it will be sent to the user. When the buffer page oil is out, the server will send the response to the client browser only after all the server scripts of the current page have been processed and the Flush or End method has been called, After the server sends the pull to the client browser, the It Buffer attribute cannot be set, so the Z Response Buffer attribute should be set in the first line of the. sap file.
(2) Request object
The Request object corresponds to the Response. The Response is used to transmit to the browser, while the Request is used to read the clothing browser, and jointly realize the interaction between the browser and the Web server. Use the Request object to access any information transmitted based on HTTP requests, including parameters, cookies, and user identification transmitted from the HTML table using the POST method or GET method. The Request object enables your program to receive the data sent by the client browser to the Web server. You can use the Request object to access all the information transmitted by any HTI based request, including the parameters, cookies and user authentication transmitted from the HTML table using the magic 51, method or GET method. The Request object enables you to access binary data sent by the client to the server. (3) Cookies
What is a cookie? Cookies are actually labels. When you visit a Weh site that needs to uniquely identify your site address, it will leave a mark on your hard disk. The next time you visit the same site, the site's page will look for this mark. Each Web site has its own tag. The content of the tag can be read at any time, but can only be completed by the page of the site. Cookies of each site exist in different files in the same folder as the 0cookies of all other sites (you can find them in the Cookies folder under the directory of Windo.). A cookie is a tag that uniquely identifies a customer. A cookie can contain information shared by all pages of a Web site during a conversation or several conversations. Cookies can also be used to exchange information between pages. Request. The cookies collection allows users to retrieve the value of cookies sent in the HITP request. This function is often used in ASP programs that require authentication of customer passwords, electronic bulletin boards, Web chat rooms, etc. (4) Server Variables
We all know that the transmission protocol used when browsing web pages in the browser is FPIFT. Some client information, such as the client's lP address, will be recorded in the HTTP header file. Sometimes the server needs to make different responses according to different client information. At this time, it needs to use the Server Variables collection to obtain the required information.