ASP built-in object of the server object detailed

Source: Internet
Author: User
Tags relative
server| Objects | built-in objects |

The server object is an important object in ASP, and many advanced features are done by it. It provides the use of active Server pages and methods, where I'll introduce a few common methods.

  1, MapPath method

This method returns the relative or physical path of the specified file. If path starts with one (/) or (\), the MapPath method treats the path as the full virtual path when it returns the paths. If path does not start with a slash, the MapPath method returns the path relative to the path already in the. asp file. For example, the test.asp file is located under C:\inetpub\wwwroot\myhome, C:\inetpub\wwwroot is the server's host directory, and Test.asp contains the following script:
<%response.write Server.MapPath (Request.ServerVariables ("path_info")%> output: C:\inetpub\wwwroot\myhome\ Test.asp
To get this result, you can also use the following methods:
<%response.write Server.MapPath ("myhome/test.asp")%>

  2, CreateObject method

This method is the most important method in the server object, and as you can see later, many features have to be used. It is used to create an ActiveX component that has been registered to the server. This is a very special feature, because using ActiveX components enables you to extend the capabilities of ActiveX.
The method used to create the server side is as follows:
Server.CreateObject ("ComponentName")
The components that are used to create can be all of the built-in components that ActiveX can use, actually all ActiveX components that exist on the server.



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.