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.