Link:http://output.to/sideway/default.asp?qno=120200017 QueryString Request ObjectThe main function of Request object is the retrieving of HTTP request variables from the client. Request.QueryString CollectionRequest.QueryString Collection retrieves the variable values of query string which is sent in the HTTP request. Syntax:Request.QueryString(variable)[(index)|.Count] Or in an ASP file. Imply <% Request.QueryString(variable)[(index)|.Count] %> Parameters:variable The parameter "variable" is the name of the variable in the HTTP query string to be retrieved. The data type of "variable" is string and is enclosed by quotation marks (" "). index The optional parameter "index" is the number of the index of a variable with multiple values in the HTTP query string to be retrieved. The data type of "index" is an integer and the range is from 1 to Request.QueryString(variable).Count .Count The parameter "Count" is the optional information of the parameter "variable" with delimeter ".". The parameter "Count" is a read-only attribute to return the total number of the available values of the parameter " variable". Remarks:The HTTP query string is the string following the question mark (?) in an HTTP request. For example: ../../../../../default.asp?qrystring=qrystringtvalue Although query string are usually generated by a response page output, query string are only strings contained in an request headers. The values of query strings can also be generated by any user. Therefore header data or user input should be encoded or be validated before using. The QueryString Collection is the detailed version of the Query_String variable of the ServerVariables Collection. With the Request.QueryString Collection, the value of query string can be retrieved by name. For variable with multiple values, the value of Request.QueryString(variable) will be in form of an array of all values of the variable in the Query_String. And the number of multiple values of the variable can be obtained by Request.QueryString(variable).Count. For single value varible, Request.QueryString(variable).Count equal to 1. If the variable does not exist, Request.QueryString(variable).Count equal to 0. And therefore the multiple values of a variable can be referenced by the parameter "index", Request.QueryString(variable)(index). and the range of the index is from 1 to Request.QueryString(variable).Count. However, if the index is not specified for a multiple values variable, the Request.QueryString(variable) will return all values in the form of comma-delimited string. Besides, if there is no specified variable for the Request.QueryString(), the Request.QueryString() will return the unparsed QueryString data. Since the multiple values of a variable is in the form of an array, the values of the variable can be retrieved using a for index loop or a for each element loop. Examples:
Link:http://output.to/sideway/default.asp?qno=120200018 Form Request ObjectThe main function of Request object is the retrieving of HTTP request variables from the client. Request.Form CollectionRequest.Form Collection retrieves the element values of a form which is sent in the body of HTTP request with a form using the POST method. Syntax:Request.Form(element)[(index)|.Count] Or in an ASP file. Imply <% Request.Form(element)[(index)|.Count] %> Parameters:element The parameter "element" is the name of the form element in the form collection to be retrieved. The data type of "element" is string and is enclosed by quotation marks (" "). index The optional parameter "index" is the number of the index of a form element with multiple values in the form collection to be retrieved. The data type of "index" is an integer and the range is from 1 to Request.Form(element).Count .Count The parameter "Count" is the optional information of the parameter "element" with delimeter ".". The parameter "Count" is a read-only attribute to return the total number of the available values of the parameter " element". Remarks:The HTTP form collection is the string posted to the HTTP request body with a form using the POST method. Although HTTP form collections are usually generated by a response page output, HTTP form collection are only strings contained in an request headers. The values of HTTP form collection can also be generated by any user. Therefore header data or user input should be encoded or be validated before using. The Form Collection is indexed by the names of the parameter elements in the request body. With the Request.Form Collection, the value of form element can be retrieved by name. For element with multiple values, the value of Request.Form(element) will be in form of an array of all values of the element in the Form Collection. And the number of multiple values of the element can be obtained by Request.Form(element).Count. For single value varible, Request.Form(element).Count equal to 1. If the variable does not exist, Request.Form(element).Count equal to 0. And therefore the multiple values of a variable can be referenced by the parameter "index", Response.Form(element)(index). and the range of the index is from 1 to Response.Form(element).Count. However, if the index is not specified for a multiple values element, the Request.Form(element) will return all values in the form of comma-delimited string. Besides, if there is no specified element for the Request.Form(), the Request.Form() will return the unparsed Form Collection data. But when post data more than 100KB, the Request.Form cannot be used. And should be rewritten by using the Request.Binary Read method. Since the multiple values of a element is in the form of an array, the values of the element can be retrieved using a for index loop or a for each element loop. And for the name of the form element, a for each element loop should be used. Examples:
Link:http://output.to/sideway/default.asp?qno=120200014 AppendToLog Response ObjectAnother function of Response object is the response of HTTP request log entries to the server log entry. Response.AppendToLog MethodResponse.AppendToLog Method appends "a string" to the end of the serer log entry for the HTTP request. Syntax:AppendToLog( Or in an ASP file. Imply <% Response.AppendToLog (string) %> Parameters:string The parameter "string" is the text to be appended to the log file. The data type of "string" is string and is enclosed by quotation marks (" "). And commas (,) cannot be used in the parameter "string" because fields in the server log are comma-delimited. Return Values:void The Response.AppendToLog Method has no return values. Remarks:The Response.AppendToLog Method can be used multiple times in one section of script and the specified string will be appended to teh existing entry. No comma (,) can be used in the parameter "string" because fields comma-delimted in the server log. However, before the specified string can be appended to the server log, the URI Query option of the Extended Properties property sheet for the site should be enabled in the Properties of the site in Web Site tab in Properties of the enable logging group. Examples:
|
Sideway BICK Blog 07/02 |