Link:http://output.to/sideway/default.asp?qno=120200023 BinaryRead / TotalBytes Request ObjectAnother function of Request object is the retrieving of HTTP data of a POST request from the client. Request.BinaryRead MethodRequest.BinaryRead Method retrieves the data part of a POST request by the server from the client. Syntax:BinaryRead( Or in an ASP file. Imply <% Request.BinaryRead(count) %> Parameters:count The paramete "count" is used to specify the number of bytes to be read from the client. The total number of bytes that actually be read is less than or equal to Request.TotalBytes. "count" contains the number of bytes successfully read from the client after method return. Return Values:Return Values by this method contains an array of unsigned bytes. The data type of the return values is VT_ARRAY | VT_UI1, which is a variant array of unsigned, one-byte characters. Remarks:Data retrieves by the method from the client is stored in a SafeArray that contains information about the number of dimensions and the bounds of its dimensions. The BinaryRead method is used to read the raw data sent by the client as part of a POST request. The raw data, which unlike the field variable format using the Request.Form collection, is a low-level format of data. Examples:
Request.TotalBytes PropertyRequest.TotalBytes Property is a read only property to specify the total number of bytes sent by the client in the body of the HTTP request Syntax:Request.TotalBytes() Or in an ASP file. Imply <% Request.TotalBytes() %> Parameters:void This property has no parameters. A variable should assign to the Request.TotalBytes for receiving the total number of bytes sent by the client. Remarks:A read only property. Examples:
Link:http://output.to/sideway/default.asp?qno=120200025 CreateObject Server ObjectThe main function of Server object is the create an instance of object on the server. Server.CreateObject MethodServer.CreateObject Method creates an instance of an object from a server component on the server. Syntax:CreateObject( Or in an ASP file. Imply <% Server.CreateObject(progID) %> Parameters:progID The paramete "progID" is used to specify the type of object to create on the server. The format for progID is [Vendor.]Component[.Version]. Return Values:This method has no return values. Remarks:If the component has implementd the OnStartPage and OnEndPage methods, the OnStartPage method will be called when the component is called by the CreateObject method. By default, objects created by the Server.CreateObject method have page scope. And therefore objects created during the processing of an ASP page will be destroyed automatically by the server after the completion of the page response. In order to create object with session or application scope, the object can be created by using the <OBJECT> tag in the Global.asa file and set the SCOPE attribute to SESSION or APPLICATION,. Or the oject can be stored in a session or an application variable. Similarly, the created object will be destroyed when the Session or Application object is destroyed. A Session object will be destroyed when the session times out, or the Session.Abandon method is called. But an object can be destroyed by setting the variable of an object to Nothing or setting the variable to a new value. But an object instance can not be created with the same name as a build-in object. Examples:
Link:http://output.to/sideway/default.asp?qno=120200027 Execute Server ObjectAnother function of Server object is the execution of file on the server. Server.Execute MethodServer.Execute Method execute an ASP file similar to a procedure call on the server. Syntax:Execute( Or in an ASP file. Imply <% Server.Execute(Path) %> Parameters:Path The paramete "Path" is used to specify the location of the ASP file to execute. The parameter Path may be either an absolute or a relative path. For an absolute Path, the path must map to an ASP script in the same application as the calling ASP file. Path can be a string variable name that is set at run-time. But the parameter Path must not contain a query string, or IIS returns an error. Return Values:This method has no return values. Remarks:The Server.Execute method calls an ASP file similar to a procedure call, and processes it as part of the calling ASP script. The Server.Execute method allows the dividing of a complex application into indivuidual modules. These ASP files forms a library that can be called whenever necessary. The Server.Execute method provides the method to call an ASP file dynamically and can be considered as an alternative approach to server-side include directives. The Server.Execute method returns the ASP 0173 error, "Invalid Path Character", if the parameter Path contains any of the following characters:
After IIS processes the ASP file specified in the input parameter to Server.Execute, the response is returned to the calling ASP script. The following collections and properties are available to the executed ASP page:
If a file is included in the calling page by using #include, the executed ASP will not use it. If either the calling or called ASP file conttains a transaction directive, the status of the transaction will apply to the ASP file that contains the directive. Examples:
|
Sideway BICK Blog 09/02 |