ASP basic tutorial (on)

xiaoxiao2021-03-06  103

ASP basic tutorial (on)

First, ASP basic knowledge

1. ASP is an abbreviation of Active Server Pages, which is an interpretation of scripting language environment; 2. ASP's run requires a Windows operating system, and PWS needs to be installed under 9x; and NT / 2000 / XP requires Internet Information Server (IIS); 3. The script tag of the ASP and JSP is "<%%>", and PHP can be set to a variety of; 4. The annotation symbol of the ASP is "'"; 5. Use additional components to extend the functionality of the ASP.

example:

HelloWorld_1.asp <% = "Hello, World"%>

Effect: Hello, World

HelloWorld_2.asp <% for i = 1 to 10RESPONSE.WRITE "Hello, World" Next%>

Effect: Hello, Worldhello, Worldhello, Worldhello, Worldhello, Worldhello, Worldhello, Worldhello, Worldhello, Worldhello, World

Note: ASP is not case sensitive; variables can be used without definition, conversion is convenient; syntax check is very loose.

Second, the use of ASP built-in objects:

You can use any of the following ASP built-in objects without having to declare in the ASP script.

1. REQUEST:

Definition: Available to access request information from the browser to the server, you can use this object to read information that has entered the HTML form.

Set: cookies: Value Form with browser cookies: QueryString in the HTML table single domain: Value ServerVariables containing query strings: Values ​​in header and environment variables

example:

Request_url.asp <% 'Get user input and store the variable user_id = request.QueryString ("user_id") user_name = request.QueryString ("user_name")

'Determine whether the user input is correct if user_id = "" ThenResponse.write "User_id is null, please check it" response.endend ifif user_name = "" TenResponse.write "user_name is null, please check it" response.endend IF

'Print variables response.write user_id & "
" response.write user_name%>

Effect: When visiting http://10.1.43.238/course/request_url.asp?user_name=j: user_id is null, please check it is access http://10.1.43.238/course/request_url.asp?user_name=j&user_id= MY_ID: my_idj

Reflections: How is the variable passed in the URL and obtained by the ASP page?

Request_form.htm