Sideway BICK BlogSideway BICK BLOG from Sideway

A Sideway to Sideway Home

Link:http://output.to/sideway/default.asp?qno=130300002

ASP Server Component, Pre-made Function, Status Component

ASP Server Components

Some 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.

Status Component

The Status component can be used to create a Status object that acts as a HTML tags holder that containg the server status information on an ASP page. However for all Windows platforms, the properties of the Status object currently all return the string "unavailable". The only need for the Status object is when runnig the ASP scripts that were developed on Macintosh and properties of the the Server status are used.

File Name

The file name of the Status component is Status.dll.

Syntax

Set StatusName =  Server.CreateObject("MSWC.Status")

Parameters

StatusName

The parameter "StatusName" is the name assigned to the instance of the Status object created by the call using the Server.CreateObject.

Remark

The Status component does not work with Internet Information Server 7 (IIS7).

Status Properties

The properties of a Status object is used as the item fields of the Status object to retrieve the information from the server.

Syntax

StatusName. PropertyName

var=StatusName. PropertyName

Parameters

StatusName

The parameter "StatusName" is the name of the instance of the Status object to be return.

PropertyName

The parameter "PropertyName" is the name of the property of the Status object instance to be return.

var

The parameter "var" is the variable name assigned to.

Return Values

For all Windows platforms, the properties of the Status object currently all return the string "unavailable". The Status properties are implemented on Macintosh Only.

Status Properties Examples

IThe Status properties implemented on Macintosh are

Value Description
Status.VisitorsSinceStart to return the number of unique visitors (IP addresses or domain names) since the server started up.
Status.RequestsSinceStart to return the number of requests since the server started up.
Status.ActiveHTTPSessions to return the current number of HTTP connections.
Status.HighHTTPSessions to return the highest number of concurrent HTTP connections since the server started up.
Status.ServerVersion to return the Personal Web Server version string.
Status.StartTime to return the time the server started up.
Status.StartDate to return the date the server started up.
Status.FreeMem to return the amount of unused memory available to the server.
Status.FreeLowMem to return the lowest value for the amount of unused memory available to the server since it started up.
Status.VisitorsToday to return the number of unique visitors (IP addresses or domain names) since midnight.
Status.RequestsToday to return the number of requests since midnight.
Status.BusyConnections to return the total number of requests that were rejected because the server was already handling the maximum number of connections it can handle.
Status.RefusedConnections to return the total number of requests that were refused because the authentication was invalid.
Status.TimedoutConnections to return the total number of connections that were closed without a request having been received.
Status.Ktransferred to return the total number of kilobytes sent by the server since the server started up.
Status.TotalRequests to return the total number of requests received since the status counters were reset using the admin tool.
Status.CurrentThreads to return the sum of the number active http connections and the number of threads in the connection thread pool that are not currently handling connections.
Status.AvailableThreads to return the number of threads in the connection thread pool that are not currently handling connections.
Status.RecentVisitors to return an HTML table listing the 32 most recent unique visitors. This table includes each visitor's domain name (or IP address if the domain name is not available) and the number of requests generated by each visitor.
Status.PopularPages to return an HTML table listing the 32 most recently visited pages. This table includes each page's URL and the number of requests for each page.

Link:http://output.to/sideway/default.asp?qno=130300003

ASP Server Component, Pre-made Function, Tools Component

ASP Server Components

Some 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.

Tools Component

The Tools component can be used to create a Tools object that acts as a HTML tags holder on an ASP page that providing some utilities for adding sophisticated functionality to the web page. 

File Name

The file name of the Tools component is Tools.dll.

Syntax

Set ToolsName = Server.CreateObject("MSWC.Tools")

Parameters

ToolsName

The parameter "ToolsName" is the name assigned to the instance of the Tools object created by the call using the Server.CreateObject.

Remark

In Personal Web Server for Windows 95 or windows 98, the Tools object has already been included in the Global.asa file in the default virtual directory.

The Tools component does not work with Internet Information Server 7 (IIS7).

Tools.FileExists Method

Tools.FileExists method is used to check the existence of a specified file published on the site by specifying the relative URL rather than an absolute URL. If the specified URL exists whith the published directory, the Tools.FileExists method returns -1. And if the specified file does not exist, the Tools.FileExists method returns 0.

Syntax

ToolsName.FileExists(URL)

Parameters

ToolsName

The parameter "ToolsName" is the name of the instance of the Tools object to be set.

URL

The optional parameter "URL" is used to specify the relative URL of the file to be checked

Tools.Owner Method

Tools.Owner method is used to check whether the current user is the site administrator. If the name and password submitted in the request header matches the Administrator name and password, the Tools.Owner method returns -1. And if the submitted name and password does not match, the Tools.Owner method returns 0. Currently,  the Tools.Owner method only works properly on Personal Web Server for Macintosh.

Syntax

ToolsName.Owner

Parameters

ToolsName

The parameter "ToolsName" is the name of the instance of the Tools object to be set.

Tools.PluginExists Method

Tools.PluginExists method is used to check the existence of the specified Macintosh server plug-in exists on the site or not. If the specified Macintosh server plug-in name is currently registered, the Tools.PluginExists method returns -1. And if the specified Macintosh server plug-in name is not registered, the Tools.PluginExists method returns 0. The Tools.PluginExists method is only used on Macintosh. For IIS for Windows 95 or latet, the Tools.PluginExists method always returns 0.

Syntax

ToolsName.PluginExists(PluginName)

Parameters

ToolsName

The parameter "ToolsName" is the name of the instance of the Tools object to be set.

PluginName

The parameter "PluginName" is used to specify the name of the Macintosh server plug-in to be checked

Tools.ProcessForm Method

Tools.ProcessForm method is used to merges data from a template file with form data submitted by a user for creating a new file. The data submitted by the user can be manipulated by script in the template file.

Syntax

ToolsName.ProcessForm(OutputFileURL, TemplateURL,[InsertionPoint])

Parameters

ToolsName

The parameter "ToolsName" is the name of the instance of the Tools object to be set.

OutputFileURL

The parameter "OutputFileURL" is used to specify the relative URL of the file to which the merged data is written.

TemplateURL

The parameter "TemplateURL" is used to specify the relative URL of the template file.

InsertionPoint

The optional parameter "InsertionPoint" is used to indicate where in the template file to start inserting the process data. The optional parameter "InsertionPoint" has not been implemented and value assigned to this parameter will be ignored.

Remarks

The template file can contain ASP scripts using the delimiters <% and %>. Scripts in  <% and %> delimiters is treated just like other text in the template file and copied into the output file. If the output file is an ASP page, the script will run when the output file is executed.

For scripts in the template file to be executed during the call to Tools.ProcessForm method, script should be placed between special delimiters  <%% and %%>. Since these scripts are executed before the template data is saved in the output file, the result of these scripts between special delimiters <%% and %%> get saved in the output file.

If the specified output file exists, the existing file will be overwritten.

If the InsertionPoint parameter does not exist, The Tools.ProcessForm method replaces the entire output file. If the InsertionPoint parameter exists, and does not begin with an asterisk (*), Tools.ProcessForm method finds the InsertionPoint string in the output file and inserts the date immediately after it. If the InsertionPoint string begins with an asterisk (*), Tools.ProcessForm method finds the InsertionPoint string in the output file and inserts the data immediately before. If the InsertionPoint string exists, but is not found in the output file, the data is appended to the end of the file.

Tools.Random Method

Tools.Random method is used to return an integer between -32768 and 32767 . The Tools.Random method is similar to the Rnd function but returns an integer. Similarly, a positive random integer can be obtained by using the Abs function. And a random integer below a specific value can be obtained by using the Mod function.

Syntax

ToolsName.Random

Parameters

ToolsName

The parameter "ToolsName" is the name of the instance of the Tools object to be set.

Examples

  • Example of making use of the Tools.FileExists method to check the existence of a file.

    ASP Page:

    <%
        Set ToolsName = Server.CreateObject("MSWC.Tools")
    %>
    <%
     If ToolsName.FileExists("/images/sideway.jpg") then
    response.write "File /images/sideway.jpg exists"
    Else
    response.write "File /images/sideway.jpg does not exist"
    End If
    %>

  • Example of making use of the Tools.ProcessForm method to generate a file.

    ASP Page, Tools_Template.asp:

    <HTML>
    <HEAD>
    <TITLE><%% =Request.Form("Title") %%></TITLE>
    </HEAD>
    <BODY>
    <H5>This file was created on <%% =Date %%>
        at <%% =Time %%></H5>
    <%
    Response.Write "<H3>Welcome to the page for:"
    Response.Write "<%% =Request.Form("Title") %%></H3>"
    %>
    <P><B>About :</B>
    <%% =Request.Form("Message") %%></P>
    </BODY>
    </HTML>

    ASP Page, Tools_ProcessForm.asp:

    <HTML> <HEAD><TITLE></TITLE></HEAD>
    <BODY>
    <%
    OutputURL = Request.Form("outputurl")
    Title= Request.Form("Title")
    Message= Request.Form("Message") 
    Process = True
    If "" = outputurl Then Process = False
    If "" = Title Then Process = False
    If "" = Message Then Process = False%>
    <H3>Using the Tools_Template.asp Template to create a page</H3> ;
    Please fill out the form. All fields are required.
    <FORM NAME="GetTemplateStuff" METHOD="POST"
        ACTION="Tools_ProcessForm.asp">
    <input type="TEXT" NAME="outputurl" size=70
        value="<%=OutputURL%>"> Relative Output URL<BR>
    <input type="TEXT" NAME="Title" size=70
        value="<%=Title%>"> Title<BR>
    <input type="TEXT" NAME="Message" size=70
        value="<%=Message%>"> Message<BR><BR>
    <INPUT type="SUBMIT" VALUE="Create File">
    </FORM>
    <% If Process Then
    Set ToolsName = Server.CreateObject("MSWC.Tools")
    ToolsName.ProcessForm OutputURL,"Tools_Template.asp","<HTML*>" %> ;
    <P><A href="<%=OutputURL%>"><%=OutputURL%></A> was created.
    <% Else
    Response.Write "No file was created because of missing inputs."
    End If %>
    </BODY>
    </HTML>

  • Example of making use of the Tools.Random method to generate a random number.

    ASP Page:

    <%
        Set ToolsName = Server.CreateObject("MSWC.Tools")
    %>
    <p>Random number between -32768 and 32767:
    <%=ToolsName.Random%> </p>

Previous Month  MAR  2013  Next Month
SMTWTFS
12
3456789
10111213141516
17181920212223
24252627282930
31

Previous Month    2010  Next Month
SMTWTFS
12345
6789101112
13141516171819
20212223242526
2728293031

Sideway BICK Blog

05/03


Copyright © 2000-2020 Sideway . All rights reserved Disclaimerslast modified on 26 January 2013