ASP Object object

xiaoxiao2021-03-06  124

AddHeader

Appendtolog

BinaryRead

Binarywrite

Buffer

CacheControl

Charset

Clear

ClientCertificate CLIENTCERTIFICATE

ContentType

End

Servervariables

EXPIRES

Expiresabsolute

Flush

FORM

IsclientConnected

PICS

QueryString

REDIRECT

Request.cookies

REQUEST

Response.cookies

Response

STATUS

Totalbytes

Write

AddHeader AddHeader method Add HTML title with the specified value. This method often adds a new HTTP title to the response. It does not replace the existing same name title. Once the title is added, it will not be deleted. This method is for advanced users only. If the other Response method provides the features you need, it is recommended that you use this method. Grammatical response.addheader name, value

parameter

Name

The name of the new title variable.

Value

The initial value stored in the new title variable.

Note To avoid named naming, no next line characters (_) are not included in Name. ServerVariables collection interprets the underscore characters in the title as a backslash. For example, the following script enables the server to find a title name called My-HEADER. <% Request.servervariables ("http_my_header")%> Because the HTTP protocol requires all the titles must be sent before the content, you must send it to the client in any output (such as an output generated by HTML or WRITE method) AddHeader calls in the script. However, when the buffer attribute is set to True, the exception is performed. If the output is buffered, you can call the AddHeader method anywhere in the script, as long as it is executed before Flush. Otherwise, a run error will result in the call to AddHeader. The following two .asp files explained this. ------- File1.asp ---------

<% Response.addheader "warning", "Error Message Text"%>

Some text on the web page.

In the previous example, the page is not buffered. However, because of the server will output some text on the web page

The AddHeader method is called before sending it to the client, so the script can work normally. If you change the order, the call to the AddHeader method will generate a runtime error. ------ File2.asp ----------

<% Response.buffer = true%>

Here's Some Text On Your Web Page.

<% Response.addheader "Warning", "Error Message Text"%> Here's Some More Interesting and illuminating text.

<% Response.flush%>

<% = Response.write ("Some String")%>

In the previous example, the page is buffered, and the result is that the server will send the output to the client until all the ASP scripts are executed or the FLUSH method is called. The call to AddHeader can appear anywhere in the script, as long as the Flush call is called. In the previous example, if the call to AddHeader appears after the call to the Flush, the script will generate a runtime error. You can send multiple copies of the same title in this way, such as using the WWW-Authenticate title. Example The following example uses the AddHeader method to request the client to use Basic authentication. <% Response.addheader "WWW-Authenticate", "Basic"%> Note which verification is to be notified by the previous script not inform the client browser. If you use this script in a web application, be sure to enable the Basic verification of the web server. For reference to the Response object, see Flush, Write, Buffer

The appendtolog appendtolog method adds a string to the end of the web server log entry. This method can be called multiple times in the same part of the script. Each time you call this method, you will add the specified string in the current entry. Grammatical response.Appendtolog string

parameter

String

To add text to the log file. Since the fields in the IIS log are separated by commas, the comma is not included in the string (,). The string is the maximum length of 80 characters.

Note To enable the specified string to log files, you must enable the URI Query option for the site Extended Logging property page, which is the active site to log in. For more information on configuring Extended Logging, see Customizing W3C Extended Logging. Apply to Response object

The BinaryRead BinaryRead method obtains data from the client to the server from the client as part of the POST request. This method gets data from the client and stores it in SafeArray. SafeArray is an array containing dimension and boundary information. Syntax Variant = Request.binaryRead (count)

parameter

Variant

An array of unsigned numbers returned by this method. The type of parameter is VT_Array | VT_UI1.

count

Before execution, specify the number of bytes to be read from the client. After this method returns,

Count will contain the number of bytes successfully read from the client. The total number of bytes that actually read will be less than or equal to

Request.totalbytes.

Note BinaryRead method is used to read the raw data from the client as part of the POST request. This method is used to access data under the bottom layer, and the Request.Form set is used to view the table data sent in the announcement request. Once binaryRead is called, reference to any variables in the Request.form collection will cause errors. Conversely, once a variable in the Request.Form collection is referenced, calling binaryWrite will also cause errors. Keep in mind that if the variable is not specified when the variable in the Request collection belongs to it, the Request.Form collection is searched and enforces the above rules. Example The following examples use the binaryRead method to place the requested content into a secure array. <%

Dim binread

DIM Bytecount

Bytecount = Request.totalBytes

Binread = Request.binaryRead (Bytecount)

%>

For reference objects, please refer to TotalBytes, ClientCertificate, Cookies, Form, QueryString, ServerVariableSbinaryWrite BinaryWrite method Write the specified information to the HTTP output without any character conversion. This method is used to write non-string information (such as binary data required for client applications). Grammatical response.binaryWrite Data

parameter

Data

Write data from HTTP output.

Example If there is an object that generates a byte array, call binaryWrite as follows to send these generated bytes to the client application. <%

Set bingen = server.createObject (my.binarygenerator)

Pict = bingen.makepicture

Response.binaryWrite Pict

%>

For reference to the Response object, see WRITE

The Buffer Buffer property indicates whether the buffer page is output. When the buffer page is output, only all server scripts of the current page are processed or when the Flush or End method is called, the server will send the response to the client. The server cannot set the buffer attribute after sending the output to the client. Therefore, response.buffer should be called in the first line of .asp file. Grammatical response.buffer [= flag]

parameter

Flag

Specifies whether the buffer page output can be one of the following values.

Value Description False does not buffer. This value is the default value. The server sends the output to the client while processing the script. TRUE does not send a response to the client unless all ASP scripts are processed or in the current page or the FLUSH or End method is called.

Note If the current ASP script is built to True, but the Flush method is not called, the server will keep the client's request. Since the server does not have to create a new connection for each client, it saves time. However, the buffer will block the client display response before the server does not process all the scripts of the previous page. For long scripts, it is possible to feel delayed. You can set the script buffer default value in the ASPBufferingOn property in the dollar database. For more information on using metadata, see the IIS metadata in the programmer reference. For the response object, please refer to Flush, End

The CacheControl CacheControl property ignores the Private default value. When you set its properties as public, the proxy server can buffer the output generated by the ASP. Grammatical response.cachecontrol [= cache control header]

parameter

Cache Control HEADER

The buffer memory control title can be a public or private.

Apply to Response object

The Charset Charset property attached the character set name (such as ISO-Latin-7) to the back of the Content-Type title in the Response object. Grammatical response.charset (charsetname)

parameter

Charsetname

Specify the string of the character set of the page. The name of the character set will be attached to

Behind the Content-Type header in the Response object.

Example For ASP pages that do not contain the response.charset property, the Content-Type title will be: Content-Type: Text / HTML

If the same .asp file contains <% response.charset ("ISO-LATIN-7")%>

The content-type title will be: content-type: text / html; charset = ISO-LATIN-7 comment inserts it into the Content-Type header regardless of the character set represented by the string. If a page contains multiple tags containing the Response.Charset, each response.charset will replace the previous CharsetName. In this way, the character set will be set to the last instance of Response.Charset in this page. On the Macintosh system, the default u.s. character set setting is not ISO-Latin-1. When processing a document, the personal web server for the Macintosh system is automatically converted from the Macintosh character set to ISO-LATIN-1. In U.S. Version, if the Response.Charset conversion character set is not used, and all the pages are assumed in the U.S. Macintosh character set for the personal web server used for the Macintosh system. Apply to Response object

The Clear Clear method deletes all HTML output in the buffer. However, the CLEAR method only deletes the response body without deleting the response title. You can use this method to handle error conditions. Note that if the response.buffer is set to True, the method will result in a runtime error. Grammatical response.clear

See End, Flush, please refer to Response object

ClientCertificate CLIENTCERTIFICATE Gather Get the verification field from the web browser publishing request (specified by the X.509 standard). If the web browser uses the SSL3.0 / PCT1 protocol (that is, it uses the URL at https: // instead of http: //) Connect the server and server request verification, the browser will send the verification field. If no authentication is sent, the ClientCertificate collection will return EMPTY. The web server must be configured to request client authentication before you can use the ClientCertificate collection. Syntax Request.ClientCertificate (key [subfield])

parameter

Key

Specifies the name of the verification field to get. Client verification includes the following fields.

Value Certificate Press the binary stream string in the ASN.1 format, including complete verification content. A set of flags of Flags, providing other client authentication information. You can set the following markers: CecertPresent - Current client verification. CEUNRECognizedissuer - The last verification of the unknown publisher. Note To use the above logo, you must include the client verification containing files in the ASP page. If you are using VBScript, you should contain Cervbs.inc. These files are installed in the / inetpub / asksamp / Samples directory. Issuer contains a string of the list of subfield values, which contains information about verifying publishers. If this value is specified without subfield items, the ClientCertificate collection returns a list of comma-separated subfields. For example, C = US, O = VeriSign, etc. SerialNumber contains a string of the verified serial number, and the serial number is represented by a 16-binary ASCII code separated by the hyphen (-). For example, 04-67-f3-02. Subject contains a string of the list of subfield values, which contains topic information about validation. If this value is specified without subfield items, the ClientCertificate collection returns a list of comma-separated subfields. For example, C = US, O = VeriSign, etc. ValidFrom specifies when verification is valid. This date follows the VBScript format and changes with the country (regional) settings. For example, in the United States, it can be expressed as 9/26/96 11:59:59 pm.validuntil Specifies when verification expires. Subfield

Optional parameters, used to search separate fields by subject or Issuer keyword. This parameter is added as a suffix

KEY parameters. For example, Issuero or SubjectCN. The following table lists some universal

Subfield value.

Value significance c Specifies the name of the original country (region). CN Specifies the name of the public user. (This subfield is only used with the Subject keyword.) GN specifies a given name. I Specify a group of first letters. L Specify the location. O Specifies the company or organization name. The name of the OU designated institution. S designated state or province. T Specify the title of this person or organization.

Unlike the values ​​listed in the above list, the value of Subfield can be identified by the ASN.1 identifier. The format of the ASN.1 identification is a series of numbers separated by the period (.). For example: 3.56.7886.34.

Note You can traverse the ClientCertificate collection by keywords. The following example demonstrates this. <%

For Each Key In Request.ClientCertificate

Response.write (Key & ":" & Request.ClientCertificate (Key) & "
")

NEXT

%>

Example The following example uses the Subject keyword test client verification exists. <%

If Len ("Subject") = 0

Response.write ("No Client Certificate Was Presented)

END IF

%>

The following example obtains the public name of the company that publishes the client authentication. <% = Request.ClientCertificate ("issuercn")%>

The following example checks the organization name of the client verification topic. <%

IF (Request.ClientCertificate ("Subject") = "MSFT")

Response.write ("Good choice!") Endiff

%>

The following example shows when client authentication expires. This Certification Will Expire ON

<% = Request.ClientCertificate ("Validuntil")%>

The following example is not known to test the publisher of the client authentication using the FLAGS keyword. The first line of include commands allow the script to use the named flag CEUNRECognizedissuer.

<%

IF Request.ClientCertificate ("flags") and ceunrecognizedissuer the

Response.write "Unrecognized Issuer"

END IF

%>

For reference objects, please refer to Cookies, Form, QueryString, ServerVariables

The ContentType ContentTYPE property specifies the HTTP content type of the response. If ContentType is not specified, the default is Text / HTML. Grammatical response.contentType [= contentType]

parameter

ContentType

Describe the string of the content type. This string is typically formatted as types / subtype, where the type is a regular content scope and subcategory is a specific content type. For a complete list of supported content types, see Web browser documents or current HTTP specification.

Example The following example sets the content type to Channel Definition Format (CDF). <% Response.contentType = "Application / X-CDF"%>

The following example sets the ContentType property to another value. <% Response.contentType = "text / html"%>

<% Response.contentType = "image / gif"%>

<% Response.contenttype = "image / jpeg"%>

Apply to Response object

The End End method causes the web server to stop processing scripts and returns current results. The remaining content in the file will not be processed. Grammatical response.end

Note If the response.buffer is set to TRUE, calling Response.end will buffer output. If you don't want to return the output to the user, you should call <%

Response.clear

Response.end

%>

See Buffer, Clear for use in response objects

ServerVariables ServerVariables sets retrieves a predetermined environment variable. Syntax Request.ServerVariables (Server Environment Variable)

parameter

Server environment variable

Specifies the server environment variable name to retrieve. You can use the values ​​listed below.

Variable Description All HTTP Title Files sent by the all_http client. All_RAW retrieves all the titles in the form in the form. All_raw and all_http are different, all_http places http_ prefix in front of the title file name, and the title name is always capitalized. When using all_raw, the title name and value appear only when the client is sent. Appl_md_path retrieves the metabological path of the ISAPI DLL (WAM) Application. Appl_physical_path retrieves the physical path corresponding to the metadata path. IIS returns the value by converting the Appl_MD_Path to the Physical (Directory) path. Auth_password This value is input to the client's authentication dialog. This variable is only available when using basic identification. Auth_type This is the server for verifying the user's verification method when the user has access protected script. Auth_user is not identified by the username. The unique ID of the CERT_COOKIE client verification is returned in a string. Can be used as a signature of the entire client verification. Cert_flags If there is a client verification, Bit0 is 1. Bit1 is set to 1 if the verification person of the client authentication is invalid (not in the CA list recognized by the server). The enactor field in Cert_issuer User Verification (O = MS, OU = IAS, CN = User Name, C = USA). The Cert_Keysize Secure Socket Tag layer The number of bits of the keyword, such as 128. The Cert_secretKeysize server verifies the number of bits of the private key. Such as 1024. Cert_serialnumber user authentication serial number field. Cert_server_issuer The issuer field of server authentication. Cert_server_subject server authentication primary field. Cert_subject The primary field verified by the client. The Content_length client issues the length of content. Content_type content data type. Use with additional information, such as HTTP query GET, POST, and PUT. The revision of the CGI specifications used by the Gateway_Iterface server. The format is CGI / Revision. HTTP_ HeaderName is stored in the title file. The title file that is not included in the table must be prefixed as an HTTP_ as a prefix so that the ServerVariables collection retrieves its value. Note The server explains the underscore (_) in Headername as the dash in the actual title. For example, if you specify http_my_header, the server will search for title files sent by My-header name. HTTPS returns ON if requests through the Secure Channel (SSL). Returns OFF if requests from non-secure channels. HTTPS_KEYSIZE Secure Sockets The number of bits of the keyword is connected, such as 128. The HTTPS_SecretKeysize server verifies the number of bits of the private key. Such as 1024. HTTPS_SERVER_ISUER The issuer field of the server authentication. HTTPS_SERVER_SUBJECT Server Verified the primary field. INSTANCE_ID text format IIS instance ID. If the instance ID is 1, it appears in the form of characters. Use this variable to retrieve the ID of the request belonging (meta) web server instance to which the request belongs. Instance_meta_path responds to the metabological path of the requested IIS instance. Local_addr Returns the server address that accepts the request. This variable is very important if you look for the address used by the request for multiple IP addresses. Logon_user User Log in to the account of Windows NT®. Additional path information provided by the Path_INFO client.

These virtual paths can be used to access scripts with the Path_Info server variable. If the information comes from the URL, it has decoded the server before reaching the CGI script. Path_TranslatedPath_info Converted version, the variable acquires the path and performs the necessary mapping by virtual to physical. Query_String Query the information after Question mark (?) In the HTTP request. Remote_addr issues the IP address of the requesting remote host. Remote_host issues a request host name. If the server doesn't have this information, it will set an empty Mote_Addr variable. Remote_user The unmapped username string sent by the user. This name is the name of the user's actual sector, which is relative to the server that verifies the filler modified. Request_method This method is used to make a request. Equivalent to GET, HEAD, POST, etc. for HTTP. Script_name executes the virtual path of the script. URL used for self-reference. Server_name appears in the server host name, DNS pseudonym, or IP address in the quote UAL. Server_port sends the port number of the request. Server_port_secure contains a string of 0 or 1. If the security port processes the request, it is 1, otherwise 0. Server_Protocol Requests the name and revision of the information protocol. Format is protocol / revision. Server_software answers the name and version of the server software for the request and run the gateway. The format is Name / Version. The URL provides the basic part of the URL. Note If the title file sent by the client cannot be found in the above table, you can add HTTP_ prefix to the title file name in calling request.serverVariables to retrieve its value. For example, if the client sends title files SomeneWheader: SomnewValue

You can retrieve SomnewValue <% Request.ServerVariables ("http_somenewheader")%> by using the following syntax

You can use a rearray to loop all server variable names. For example, print out all of the server names using the following scripts.

Server Variable value

<% For each name in request.servervariables%>

<% = Name%> <% = Request.ServerVariables (name)%>

<% Next%>

Example The following example displays some server variables using the Request object.

ALL_HTTP Server Variable =

<% = Request.ServerVariables ("all_http")%>

Content_length server variable =

<% = Request.ServerVariables ("Content_length")%>

Content_Type Server Variable =

<% = Request.serverVariables ("Content_Type")%>
Query_String Server Variable =

<% = Request.ServerVariables ("Query_String")%>

Server_Software Server Variable =

<% = Request.ServerVariables ("Server_Software")%>

The next example uses the ServerVariables collection to insert the server name into a hypertext link.

/scripts/mypage.asp">link to mypage.asp

For reference object, please refer to ClientCertificate, Cookies, Form, QueryString

The Expires Expires property specifies how much time is there a pager expiration in the browser buffered. If the user returns to this page before a page expires, the version in the buffer is displayed. Syntax response.expires [= number]

parameter

Number

How many minutes are there in an expiration. Set this parameter to 0 to make the cache page immediately expire.

Note If this property is set multiple times on one page, the shortest time is used. See Expiresabsolute for application to Response objects

The ExpiresAbsolute ExpiresabSolute property specifies the expiration date and time of the page cached in the browser. If the user returns to the page before the user is returned to the page, the cached page is displayed. This home page expires on the same day if not specified. If the date is not specified, the home page expires at the specified time of the script running on the day. Grammatical response.expiresabsolute [= [date] [Time]]

parameter

date

Specify the expiration date of the page. This value is sent in the expiration header that conforms to the RFC-1123 date format.

Time

Specify the expiration time of the page. This value is converted to a GMT time before the expiration title is sent.

Note If the property is set multiple times in the page, the date and time of the earliest expiration is accurate. Example The following sample specified page expires at 1:30 pm on May 31, 1996. <% Response.expiresabsolute = # May 31,1996 13:30: 15 #%>

For the response object, see Expires

The Flush Flush method immediately transmits the output in the buffer. This method will result in runtime errors if the response.buffer is set to TRUE. Grammatical response.flush

Note If the Flush method is called on the ASP page, the server will respond to the request on the page. Apply to Response object

The Form Form set retrieves the value of the table element in the HTTP request body by using the form of the POST method. Syntax Request.form (Element) [(index) | .count]

parameter

ELEMENT

Specifies the name of the table element to be retrieved.

Index

Optional parameters, using this parameter can access one of multiple values ​​in a parameter. It can be 1 to

Any integer between Request.form (Parameter) .count.

Note The Form set is indexed by the name of the parameter in the text. The value of Request.Form (Element) is an array requesting all ELEMENT values ​​in the body. Determine the number of values ​​in the parameter by calling Request.form (Element) .count. If the parameter is not associated with multiple values, the count is 1. If the parameters are not found, the count is 0. To reference a single value in a table element with multiple values, you must specify an index value. The index parameter can be any number from 1 to REQUEST.FORM (Element) .count. If one of the plurality of table parameters is referenced, the index value is not specified, the returned data will be a comma-separated string. When using the request.form parameter, the web server analyzes the HTTP request body and returns the specified data. If the application requires unsatisfactory table data, you can access the data by calling the request.form without a parameter. Use the revision to traverse all data values ​​in the table request. For example, the user fills in the form by specifying two values, chocolate and butterscotch. For FavoriteFlavor parameters, you can retrieve these values ​​using the following scripts. <% For Each Item in Request.form ("FavoriteFlavor")

Response.write item & "
"

NEXT

%>

The script is shown below. Chocolate

ButtersCotch

Use the for ... Next loop to generate the same output, as shown in the following script. <%

For i = 1 to request.form ("favoriteflavor"). Count

Response.write Request.form ("Favoriteflavor") (i) & "
"

NEXT

%>

Use this reset to display the parameter name. As shown in the following script. <% For Each X in Request.Form%>

Request.form (<% = x%>) = <% = Request.form (x)%>

<% Next%>

This script displays the following information on your browser. Favoriteflavor = chocolate

Favoriteflavor = ButtersCotch

Example consider the following table.

Your first name:

what is your favorite ice cream flavor:

The following request text can be sent from this script. Firstname = James & flavor = Rocky Road

You can use the following script. Welcome, <% = Request.form ("firstname")%>.

Your Favorite Flavor is <% = Request.form ("Flavor")%>. The output below is the result. Welcome, James. Your Favorite Flavor is Rocky Road.

If you use the following script the unparsed form data is: <% = request.form%>

The result is the unparsed form data is: firstname = james & flavor = rocky road

Applications to Request Object See ClientCertificate, Cookies, QueryString, ServerVariables

The isclientConnected isclientConnected property is read-only, and it indicates whether the client is connected to the server since the last call response.write. Grammatical response.isclientConnected ()

Note This property allows users to have more controls in the case where the client is not connected to the server. For example, in the case where the request is filed from the client, it will be used for a long time, which may help ensure that the client is still connected before continuing the script. Example <%

'Check to See eti the client is connected

IF not response.isclientconnected then

'get the sessionid to send to the shutdown function

Shutdownid = session.SessionID

'Perform Shutdown Processing

Shutdown (shutdownid)

END IF

%> Applying to Response object

PICS PICS Property adds a value to the PICS tab field of the response title. Grammar Response.PICS (PICSLabel)

parameter

PICSLabel

A PICS label string appropriately formatted. by

The value specified by PICSLabel will be added to the PICS tag field in the response title.

Example for inclusion <%

Response.pics ("(PICS-1.1 Labels On" & Chr (34) & "1997.01.05T08: 15-000" & Chr (34) & "Until "& chr (34) &" 1999.12.31t23: 59-0000 "& chr (34) &" Ratings (V 0 S 0 L 0 N 0) ")

%>

The .asp file will add the following title: pics-label: (PICS-1.1 Labels on "1997.01.05T08: 15-0500" Until "1999.12.31t23: 59-0000 "Ratings (V 0 s 0 l 0 n 0))))

Note The PICS property is inserted into any string in the title, regardless of whether it represents a valid PICS tag. If a single page contains a plurality of tags containing Response.Pics, each instance replaces the PICS tag set up a PICS tag. As a result, PICS will be set to the value specified by the previous response.pics instance. Since the PICS tag contains quotation marks, you must replace each quotation with "& chr (34) &". Applying the Response object QueryString queryString set Retrieves the value of the variable in the HTTP query string. The HTTP query string is specified by the value after the question mark (?). Several different processes can generate a query string. For example, Anchor mark String Sample "THIS IS A SAMPLE" variable name string. You can also generate a query string by sending a table or typing a query in an address box in its browser. Syntax Request.QueryString (variable) [(INDEX) | .count]

parameter

Variable

Specify the variable name to retrieve in the HTTP query string.

Index

This is an optional parameter that can be used to retrieve

Variable's multiple values ​​of the VARIABLE. This can be from 1 to

Request.QueryString (variable). Any integer between .CONT.

Note QueryString Collection is an analysis version of Query_String variable in the ServerVariables collection. It allows you to retrieve query_string variables in a name. The value of the request.QueryString is an array of values ​​that appear in all parameters in query_string. You can determine how many values ​​have parameters by calling request.QueryString (parameter) .count. If the variable is not associated with multiple data sets, the count is 1. If the variable is not found, the count is 0. To reference the querystring variable in one of multiple data sets, specify the value of Index. The index parameter can be 1 to Request.QueryString (Variable). COUNT. If you do not specify the value of Index, reference to a variable in multiple querystring variables, the returned data is a comma-separated string. When using parameters in Request.QueryString, the server analysis sends to the requested parameter and returns the specified data. This data can be retrieved by calling non-parametric request.QueryString by calling request.QueryString without parameters. You can use a reply in the query string to loop over all data values. For example, if you send the following request http: //names.asp? Q = fred & q = Sally

And Names.asp contains the following script, - names.asp ---

<%

For Each Item in Request.QueryString ("Q")

Response.write item & "
"

NEXT

%>

Names.asp will appear as follows. Fred

Sally

The above scripts can also be written with count. <%

For i = 1 to request.QueryString ("q"). Count

Response.write Request.QueryString ("Q") (i) & "
"

NEXT

%>

Example Client Request /scripts/directory-lookup.asp?name=fred&age=222Results in the following query_string value. Name = fred & agn = 22.

QueryString collection will contain two members of Name and AGE. So you can use the following script. Welcome, <% = Request.QueryString ("name")%>.

Your age is <% = request.QueryString ("agn")%>.

Welcome, Fred. Your Age IS 22 will be output.

If you use the following script the unparsed query string is: <% = request.queryString%>

Will output the unparsed query string is: name = fred & agn = 22

For reference objects, please refer to ClientCertificate, Cookies, Form, ServerVariables

The Redirect Redirect method enables the browser attempt to connect to other URLs. Syntax response.redirect url

parameter

URL

The browser is redirected to the Uniform Resource Locator (URL).

Note Any response body content that is explicitly set on the page will be ignored. However, this method does not send other HTTP titles set by the page to the client. An automatic response body that will be redirected as a link will be generated. The Redirect method sends the following explicit title, where the URL is the value passed to the method. HTTP / 1.0 302 Object Moved

Location URL

Apply to Response object

The cookies cookies collection allows the user to retrieve the value of the cookie sent in the HTTP request. Syntax Request.Cookies (cookie) [(key) | .attribute]

parameter

cookie

Specifies the cookie to retrieve its value.

Key

Optional parameters for retrieving the value of the sub-key from the cookie dictionary.

Attrib

Specify information about cookie itself. Its attribute parameters are as follows:

Name Haskeys read-only. Specifies whether cookies contains a keyword.

Note You can access the sub-keywords of the cookie dictionary by including a KEY value. If you do not specify a key when accessing the Cookie dictionary, all keywords are returned as a single query string. For example, if MyCookie has two keywords, first, and second, no keywords are specified when calling request.cookies, then the following string will be returned. First = firstKeyValue & Second = SecondKeyValue

If the client browser sends two favorite cookies, then Request.cookie will return one of the deeper path structure. For example, if there are two favorite cookies, but one of the path properties is / WWW / and the other is / www / home /, the client browser simultaneously sends two cookies to / www / home / directory Then, Request.cookie will only return the second cookie. To determine if a cookie is not a cookie dictionary (Cookie has a keyword), you can use the following scripts. <% = Request.cookies ("MyCookie"). Haskeys%>

If MyCookie is a cookie dictionary, the previous assignment is True. Otherwise, for False. You can pass all the keywords in all cookies or cookies in the Cookies collection. However, it will not generate any output on cookies without keywords without keywords. Use the Haskeys syntax first check if the cookie has a keyword, and you can avoid this. The following example demonstrates this. <% 'Print Out The Entire Cookie Collection.

For Each Cookie in Request.cookies

IF not cookie.haskeys the

'Print Out the cookie string

%>

<% = cookie%> = <% = Request.cookies (cookie)%>

<%

Else

'Print Out The Cookie Collection

For Each Key In Request.cookies (cookie)

%>

<% = cookie%> (<% = key%>) = <% = Request.cookies (cookie) (KEY)%>

<%

NEXT

END IF

NEXT

%>

Example The following example prints the value of MyCookie in the web page. This is a cookie value called MyCookie:

<% = Request.cookies ("MyCookie")%>

See ClientCertificate, Form, QueryString, ServerVariables for use in Request objects

The Request object Request object retrieves the client browser to the server of the server during the HTTP request. Syntax Request [.collection | Property | Method] (Variable)

set

ClientCertificate is stored in a field value in the client certificate in the HTTP request. The value of the cookie sent in the cookieshttp request. FormHTTP requests the value of the table element in the body. QueryStringHTTP query the value of the variable in the string. ServerVariables The value of a predetermined environment variable. Attributes

TotalBytes only allows you to read. Specifies the number of bytes sent by the client in the request. method

BinaryRead retrieves data from the client to the server as part of the POST request. Variable parameters are some strings that specify items to retrieve from the collection or as inputs to methods or properties. For more information on the variable parameter, see Each Collection Description. Note If the specified variable is not one of the five sets described above, the Request object returns EMPTY. All variables can be used directly by calling the request (variable) without the name of the collection. Because of this, the web server can search for a collection in order below.

QueryString form Cookies ClientCertificate ServerVariables If the same name, the variable of the same name appears in multiple collections, the Request object returns the first instance of the encountered. We recommend using a full name when members involving ServerVariables collection. For example, you don't have to use Request.ServerVariables (Auth_user) without request. (Auth_user). See the Response object

Cookies cookies set set the value of the cookie. Create it if the specified cookie does not exist. If there is, set the new value and delete the old value. Syntax response.cookies (cookie) [(key) | .attribute] = value parameter

cookie

The name of the cookie.

Key

Optional parameters. If specified

KEY, cookie is a dictionary, and

Key will be set to

Value.

Attribute

Specify information about cookie itself. Attribute parameters can be one of the following:

Name Description Domain only allows you to write. If it is specified, the cookie will be sent to the request for the domain. Expires only allows you to write. The expiration date of cookie. In order to store the cookie on the client disk after the session, you must set this date. If the settings of this attribute do not exceed the current date, the cookie will expire after the task is completed. Haskeys only allows you to read. Specifies whether cookies contains a keyword. Path only allows you to write. If it is specified, the cookie will only be sent to the request to the path. If this property is not set, the path to the application is used. Secure only allows you to write. Specifies whether cookies are safe.

Value

Specify assignment

Key or

Attribute's value.

Note If you have created a cookie with keywords, as shown in the following script, <%

Response.cookies ("MyCookie") ("Type1") = "sugar"

Response.cookies ("MyCookie") ("Type2") = "Ginger Snap"

%>

Then this title will be sent. Set-cookie: mycookie = type1 = sugar & type2 = Ginger Snap

If you do not specify a keyword when specifying myCookie, Type1 and Type2 will be destroy. As shown in the following example. <% Response.cookies ("mycookie") = "chocolate chip"%>

In the previous example, keyword type1 and type2 are destroyed and its value is also deleted. MyCookie cookies are only the value of Chocolate Chip. Conversely, if you call your cookie with a keyword, you will destroy any keywords containing the cookie. For example, if after the above code, use the following statement to call Response.cookies ("NEWTYPE") = "peanut butter"%>

Then Chocolate Chip's value will be deleted and the NewType will be set to the peanut butter. To determine if a cookie has a keyword, you can use the following syntax. <% = Response.cookies ("mycookie"). Haskeys%>

If MyCookie is a cookie dictionary, the previous value is True. Otherwise, for False. You can set the properties of the cookie by looping. For example, you want to set all the cookies to expires in a specific date, you can use the following syntax. <%

For Each Cookie in Response.cookies

Response.cookie (cookie) .expires = #july 4, 1997 #

NEXT%>

You can use a loop to set all the cookies in a collection or all keywords in a cookie. However, the loop will not be executed if the cookie does not have a keyword. To avoid this, you can use .Haskeys syntax Check if a cookie has a keyword. The following example illustrates this. <%

IF not cookie.haskeys the

'Set the value of the cookie

Response.cookies (cookie) = ""

Else

'Set The Value for Each Key in the cookie collection

For Each Key In Response.cookies (cookie)

Response.cookies (cookie) (KEY) = ""

Next Key

%>

Example The following example illustrates how to set the value of the cookie and how to assign a value for its properties. <%

Response.cookies ("Type") = "chocolate chip"

Response.cookies ("Type"). Expires = "July 31, 1997"

Response.cookies ("Type"). Domain = "msn.com"

Response.cookies ("Type"). Path = "/ www / Home /"

Response.cookies ("type"). Secure = false

%>

See Request.cookies for use in response objects

The Response object uses the Response object to send the output to the client. Syntax Response.collection | Property | Method

set

Cookie Specifies the cookie value. You can use this collection to set the value of the cookie. Attributes

Buffer indicates whether page output is buffered. CacheControl determines whether the proxy server can cache the output generated by the ASP. Charset adds the name of the character set to the content type header. ContentType specifies the HTTP content type of the response. Expires Specifies the time of the cache before the cached page sleeps in the browser. ExpireSabSolute Specifies the date and time of the cache page timeout on your browser. IsclientConnected indicates whether the client is disconnected from the server. PICS adds the value of the PICS tag to the PICS tag field of the response title. The value of the status row returned by the Status server. method

AddHeader Sets the HTML title from the name to value. Appendtolog After adding a string after the requested web server log entry. BinaryWrite will give the information to the current HTTP output and do not perform any character set conversion. CLEAR clears any buffer HTML output. END stops processing the .asp file and returns the current result. Flush immediately sends buffer output. Redirect sends the information to the browser and attempts to connect another URL. WRITE writes the variable as a string to the current HTTP output. See the Request object

The Status status property specifies the value of the status row returned by the server. The STATUS value is defined in the HTTP specification. Grammatical response.status = statusdescription

parameter

StatusDescription

A string containing a three-digit number of the status code and a short description of the code. For example, 310 Move Permanently.

Note Use this property to modify the status line returned by the server. Example The following example sets the response status. <% Response.status = "401 unauthorized"%> Applying to Response object

Totalbytes Totalbytes Properties Specifies the total number of bytes sent by the client in the request. This property is only allowed to read. Syntax counter = request.totalbytes

parameter

Counter

Specifies a variable to receive the number of people transmitted in the request.

Example The following script sets a variable equal to the total number of bytes included in the request object. <%

DIM Bytecount

Bytecount = Request.totalBytes

%> Apply to the Request object See binaryRead

Write Write method writes the specified string to the current HTTP output. Grammar Response.write Variant

parameter

Variant

The data that needs to be written. This parameter can be a Variant data type of any Visual Basic scripting edition, including characters, strings, and integers. This value cannot include character combination%>, if desired, the escape sequence% /> can be used instead. The web server will convert this escape sequence when processing the script.

Example The following example sends the output to the client with the Response.Write method. I Just Want to Say <% response.write "Hello World."%>

Your name is: <% response.write request.form ("name")%>

The following example adds an HTML tag to the web page output. Since the string returned by the WRITE method does not contain character combination%>, the generation is% />. The following script <% response.write "

"%>

Output

For reference to the Response object, please refer to BinaryWrite

© 1997 by Microsoft Corporation. All Rights Reserved.

转载请注明原文地址:https://www.9cbs.com/read-126946.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.037, SQL: 9