ASP Component Application

Source: Internet
Author: User

ASP components
An ASP server component is a collection of source code that has been made available by Microsoft (advanced users can also build their own parts), which are included in IIS. Using ASP, you can unlock this power before making the code.

Advertising tizag.com
These objects can be used to do a ton of things, such as: an easy-to-use advertising rotation service, an interface to a database, a means of manipulating files and more work.

Leveraging ASP Components
Using Microsoft's ASP components in ASP programming, you can do so much with ASP that you will kick yourself without using components earlier. You can use these built-in components to create objects. See our previous lesson if you need anything to review the ASP object.

In this lesson, we will use the Microsoft File system component to display all the files in our current directory. First, what we need to do is build a filesystem object so we can use all the properties and methods that are in this section. Note: The film Services co-ordination section represents the file system object in this example.

<%
Dim Myfso
Set Myfso = _
Server.CreateObject ("Scripting.FileSystemObject")
Set Myfso = Nothing
%>

Features of accessing an ASP component
Once you have created an object you want, you can access all the parts of the method and variables. We have created an instance file system component and stored it in the MYFSO. We need the folders we want to list all the files and GetFolder methods Our section will complete this work.

Using the same directory, we decided to use the path in the running ASP lesson we are going to build to this film services co-ordination section "C:inetpub wwwroot tizagasp", the same directory said, "Tizagcomponent.asp" save in.

<%
Dim Myfso, myFolder
Set Myfso = _
Server.CreateObject ("Scripting.FileSystemObject")
Set MyFolder = _myfso.getfolder ("c:inetpubwwwroottizagasp")
Response.Write ("Current folder is:" & Myfolder.name)
Set MyFolder = Nothing
Set Myfso = Nothing
%>

Finished the
The past thing on our work list is to get the name of the file in our working directory. The Folder object contains a method that returns a collection of all the files in the current directory. Code to enter this collection and display the filename is in the following example.

<%
Dim Myfso, MyFolder
Set Myfso = _
Server.CreateObject ("Scripting.FileSystemObject")
Set MyFolder = _myfso.getfolder ("c:inetpubwwwroottizagasp")
Response.Write ("Current folder is:" & Myfolder.name)

For each Fileitem in Myfolder.files
Response.Write ("<br/>" & Fileitem.name)
Next
Set MyFolder = Nothing
Set Myfso = Nothing
%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.