Sideway
output.to from Sideway
Draft for Information Only

Content

ASP Server Components
  Tools Component
    File Name
    Syntax
    Parameters
    Remark
   Tools.FileExists Method
    Syntax
    Parameters
   Tools.Owner Method
    Syntax
    Parameters
   Tools.PluginExists Method
    Syntax
    Parameters
   Tools.ProcessForm Method
    Syntax
    Parameters
    Remarks
   Tools.Random Method
    Syntax
    Parameters
   Examples

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>


©sideway

ID: 130300003 Last Updated: 3/8/2013 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Set 1

Logic 1

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019