Link:http://output.to/sideway/default.asp?qno=130200009 ASP Server Component, Pre-made Function, Logging Utility Component ASP Server ComponentsSome of the ASP server components are the common features found in dynamic web pages. These base ASP server components are provided to enrich the pre-made functions of ASP technology for making dynamic and interactive web pages. However, some IIS pre-made components are not installed for all version of IIS. Ad Rotator, Browser Capabilities, Content Linker, Content Rotator, Counters, Logging Utility, My Info, Page Counter, Status, and tools are not installed with IIS 6.0. However, if you upgrade your Web server from a previous version of IIS, the pre-made components are not removed. Some IIS pre-made components, ASP content rotator and nextlink, are deprecated in IIS7. And most IIS pre-made components are either not installed with IIS7 or their usage is not supported. Logging Utility ComponentThe Logging Utility Component can be used to create an IISLog object that acts as a HTML tags holder on an ASP page for reading entries from the IIS log on a web page. The IISLog object provide the needed tools to open, close, check end of record and add read filter of an IISLog for reading and writing a log record to the IIS log. Besides, a specific information can also be retrieved by specifying the corresponding properties of the IISLog object accordingly. In other words, the IISLog,OpenLogFile method should be used to specify from which the IIS log file to be retrieved. Then, the appropriate log records can be read by the IISLog, the IISLog,ReadLogRecord method. And the properties of the IISLog object can be used to retrieve the required information from the log records. Therefore an IISLog object can be used in an ASP page to extract information from the IISLog file. However, only an Administrator or Operator on the server on which the IIS is running is authenticated to instantiate the Logging Utility component when accessing the ASP script. If the user is only Anonymous, the Logging Utility component will not function properly. The built-in Logging Utility Component can only support the four built-in logging modules that come with IIS web server. Therefore only log files created by the four built-in logging modules can be accessed through the IISLog,ReadLogRecord method of the built-in Logging Utility Component. If the log file is created by custom or third-party logging module, the built-in Logging Utility Component should be enhanced before the IISLog,ReadLogRecord method can read the record in the log file created by the custom or third-party logging module. File NameThe file name of the Content Rotator component is Logscrpt.dll. SyntaxSet IISLogName = Server.CreateObject( "MSWC.IISLog" ) ParametersIISLogName The parameter "IISLogName" is the name assigned to the instance of the IISLog object created by the call using the Server.CreateObject. RemarkThe Content Rotator component does not work with Internet Information Server 7 (IIS7). IISLog.AtEndOfLog MethodIISLog.AtEndOfLog method is used to check whether there are any more reacords available in the IIS log file by attempting to read a log record from the IIS log file specified by the IISLog.OpenLogFile method. The IISLog.AtEndOfLog method returns TRUE when an attempt to read past the end of the IIS log file. Syntax SyntaxIISLogName.AtEndOfLog() ParametersIISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn Values by this method contains an boolean data. IISLog.AtEndOfLog method returns "TRUE" only if there is no more record can be read from the IIS log file. Otherwise, IISLog.AtEndOfLog method will return "FALSE" IISLog.CloseLogFiles Method
IISLog.CloseLogFiles method is used to
close all opened IIS log files which are opened by the IISLog object using the
IISLog.OpenLogFile method according to the specified IOMode parameter. Syntax SyntaxIISLogName.CloseLogFiles(IOMode) ParametersIISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. IOMode The parameter "IOMode" is a "Long" type value used to specify which types of log file or files to be closed by the IISLog.CloseLogFiles method. The possible values are:
Value=1: Constant name "ForReading" is used to indicate that all log files that
have been opened for reading by IISLog object should be closed IISLog.OpenLogFile MethodIISLog.OpenLogFile method is used to open the specified log file for reading or writing by IISLog object. In order to return the correct log file for log file manipulation by the IISLog object, none of the parameters of the IISLog.OpenLogFile method are optional Syntax Syntax
IISLogName.OpenLogFile( ParametersIISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. FileName The parameter "FileName" is the name of the log file to be opened by the IISLog.OpenLogFile method. IOMode The parameter "IOMode" is used to specify whether the log file to be opened by the IISLog.OpenLogFile method is opened for reading or writing. The possible values are:
Value=1: Constant name "ForReading" is used to indicate that the log file
to be opened by the IISLog.OpenLogFile method is opened for reading by IISLog
object only ServiceName The parameter "ServiceName" is used to specify the service name of the logging module which is used to create the log file that is used for log file manipulation by the IISLog object. Only the matched log file created by the specified logging module will return records by the IISLog object. ServiceInstanceviceInstance The parameter "ServiceInstance" is used to specify the specific instance of the named service of the logging module which is used to create the log file that is used for log file manipulation by the IISLog object. Only the matched log file created by the specified named service of the logging module will return records by the IISLog object. OutputLogFileFormat The parameter "OutputLogFileFormat" is used to specify the format of the matched log file that is used for log file manipulation by the IISLog object. IISLog.ReadFilter MethodIISLog.ReadFilter method is used to specify the constraint in terms of a date and time range filter for reading log records from the log file for log file manipulation by the IISLog object. Although bothe the "startDateTime" and "endDateTime" are optional parameters, at least one parameter should be specified. Syntax SyntaxIISLogName.ReadFilter([startDateTime],[endDateTime]) ParametersIISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. startDateTime The optional parameter "startDateTime" is used to specify the date and time after which log records are to be read. endDateTime The optional parameter "endDateTime" is used to specify the date and time before which log records are to be read. IISLog.ReadLogRecord MethodIISLog.ReadLogRecord method is used to read the next available log record from the log file for log file manipulation by the IISLog object. SyntaxIISLogName.ReadLogRecord() ParametersIISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. IISLog.WriteLogRecord MethodIISLog.WriteLogRecord method is used to write the new log record read from another the log file using another IISLog object to the opened log file by the IISLog object. SyntaxIISLogName.WriteLogRecord(IISLogReadName) ParametersIISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to which the log record is written. IISLogReadName The parameter "IISLogReadName" is the name of the instance of the IISLog object from which the log record is read. IISLog.BytesReceived PropertyIISLog.BytesReceived property is used to retrieve the number of bytes received during the operation from the current log record read by the IISLog object. Syntaxcount=IISLogName.BytesReceived Parameterscount The parameter "count" is the number of bytes received field from the current log record assigned to. IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.BytesSent PropertyIISLog.BytesSent property is used to retrieve the number of bytes sent during the operation from the current log record read by the IISLog object. Syntaxcount=IISLogName.BytesSent Parameterscount The parameter "count" is the number of bytes sent field from the current log record assigned to. IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ClientIP PropertyIISLog.ClientIP property is used to retrieve the client's IP address for the operation from the current log record read by the IISLog object. Syntaxvar=IISLogName.ClientIP Parametersvar The parameter "var" is the client's IP address field from the current log record assigned to. IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.Cookie PropertyIISLog.Cookie property is used to retrieve the client's cookie for the operation from the current log record read by the IISLog object. Syntaxvar=IISLogName.Cookie Parametersvar The parameter "var" is the cookie field from the current log record assigned to. IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.CustomFields PropertyIISLog.CustomFields property is used to extract the customfields for the operation from the current log record read by the IISLog object. The IISLog.CustomFields property enable the IISLog object to retrieve any custom or special fields, such as extra custom HTTP headers included in the HTTP operation that were logged by IIS Syntaxvar=IISLogName.CustomFields Parametersvar The parameter "var" is a two-dimensional array of variants to which each pair of variants in form of a paired key-value to describle an HTTP header in the CustomFields field extracted from the current log record assigned. IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.DateTime PropertyIISLog.DateTime property is used to retrieve the date and time in GMT of the operation from the current log record read by the IISLog object. Syntaxvar=IISLogName.DateTime Parametersvar The parameter "var" is the data and time field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.Method PropertyIISLog.Method property is used to extract the HTTP operation type from the current log record read by the IISLog object. Syntaxvar=IISLogName.Method Parametersvar The parameter "var" is the HTTP operation type such as GET or PUT extracted of the Method field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ProtocolStatus PropertyIISLog.ProtocolStatus property is used to retrieve the HTTP protocol status code for the HTTP operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.ProtocolStatus Parametersvar The parameter "var" is the ProtocolStatus field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ProtocolVersion PropertyIISLog.ProtocolVersion property is used to retrieve the ProtocolVersion string from the current log record read by the IISLog object. Syntaxvar=IISLogName.ProtocolVersion Parametersvar The parameter "var" is the ProtocolVersion field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.Referer PropertyIISLog.Referer property is used to retrieve the referer URL from the current log record read by the IISLog object. Syntaxvar=IISLogName.Referer Parametersvar The parameter "var" is the Referer field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ServerIP PropertyIISLog.ServerIP property is used to retrieve the server's IP address for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.ServerIP Parametersvar The parameter "var" is the IP address of the server in the ServerIP field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ServerName PropertyIISLog.ServerName property is used to retrieve the name of the computer for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.ServerName Parametersvar The parameter "var" is the name of the computer in the ServerName field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ServerPort PropertyIISLog.ServerPort property is used to retrieve the port number used for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.ServerPort Parametersvar The parameter "var" is the port number used for the operation in the ServerPort field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.ServiceName PropertyIISLog.ServiceName property is used to retrieve the name of service including the server instance from the current log record read by the IISLog object. Syntaxvar=IISLogName.ServiceName Parametersvar The parameter "var" is the ServiceName field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.TimeTaken PropertyIISLog.TimeTaken property is used to retrieve the total processing time required for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.TimeTaken Parametersvar The parameter "var" is the TimeTaken field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.URIQuery PropertyIISLog.URIQuery property is used to retrieve any HTTP request parameters or query string that was passed for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.URIQuery Parametersvar The parameter "var" is the URIQuery field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.URIStem PropertyIISLog.URIStem property is used to retrieve the target URL for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.URIStem Parametersvar The parameter "var" is the URIStem field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.UserAgent PropertyIISLog.UserAgent property is used to retrieve the browser user agent string for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.UserAgent Parametersvar The parameter "var" is the UserAgent field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.UserName PropertyIISLog.UserName property is used to retrieve the user name of non-anonymous client for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.UserName Parametersvar The parameter "var" is the UserName field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. IISLog.Win32Status PropertyIISLog.Win32Status property is used to retrieve the Win32 status code for the operation referred to from the current log record read by the IISLog object. Syntaxvar=IISLogName.Win32Status Parametersvar The parameter "var" is the Win32Status field from the current log record assigned to IISLogName The parameter "IISLogName" is the name of the instance of the IISLog object to be set. Return ValuesReturn values only available when the property is configured to log the specified property on the Web server in the log files. |
Sideway BICK Blog 16/02 |