Page 228 - DCAP408_WEB_PROGRAMMING
P. 228

Web Programming




                    Notes          9.2 ASP Server Object

                                   The ASP Server object is used to access properties and methods on the server. Its properties and
                                   methods are described below:

                                   Properties


                                     Property          Description
                                     Script Timeout    Sets or returns the maximum number of seconds a script can run before it
                                                       is terminated


                                   Methods

                                     Method           Description
                                     Create Object    Creates an instance of an object
                                     Execute          Executes an ASP file from inside another ASP file
                                     GetLastError()   Returns an ASPError object that describes the error condition that occurred
                                     HTMLEncode       Applies HTML encoding to a specified string
                                     Map Path         Maps a specified path to a physical path
                                     Transfer         Sends (transfers) all the information created in one ASP file to a second ASP
                                                      file
                                     URLEncode        Applies URL encoding rules to a specified string

                                          Example: When a file was last modified?

                                   Checks when this file was last modified.
                                     ASP CODE                                            OUTPUT
                                     <html>                                              This  file  was  last  modified
                                     <body>                                              on: 18/05/2003 14:48:10

                                     <%
                                     Set        fs         =        Server.CreateObject
                                     ("Scripting.FileSystemObject")
                                     Set                      rs                     =
                                     fs.GetFile(Server.MapPath("demo_lastmodified.asp"))
                                     modified           =           rs.DateLastModified
                                     %>
                                     This     file     was    last     modified     on:
                                     <%response.write(modified)
                                     Set            rs            =             Nothing
                                     Set            fs            =             Nothing
                                     %>

                                     </body>
                                     </html>














          222                               LOVELY PROFESSIONAL UNIVERSITY
   223   224   225   226   227   228   229   230   231   232   233