To read the article online, visit http://www.4GuysFromRolla.com/webtech/tips/t110699-1.shtml

User Tip: Obtaining the Last Modified Date of an ASP Page
From Jeremy L.:

If you want to find the last modified date/time of any of your files, create a file called modified.asp and include the following code:

<% Dim strFileName Dim dtmLastModified Dim dtmLastModifiedDate Dim dtmLastModifiedTime strFileName = Request.ServerVariables("SCRIPT_NAME") strFileName = Replace(strFileName, "/", "\") strFileName = Server.MapPath(strFileName) Set objFileSystemObject = Server.CreateObject("Scripting.FileSystemObject") Set objFile = objFileSystemObject.GetFile(strFileName) dtmLastModified = objFile.DateLastModified Set objFile = Nothing Set objFileSystemObject = Nothing dtmLastModifiedDate = FormatDateTime(dtmLastModified, 1) dtmLastModifiedTime = FormatDateTime(dtmLastModified, 3) Response.Write(dtmLastModifiedDate & " " & dtmLastModifiedTime) %>

Then, all you have to do is include this file in any pages you want to display the lost modified date/time of that page. Remember to include it where you want to display it. For example, I might have the following page:

<HTML> <HEAD> <TITLE>Last Modified</TITLE> </HEAD> <BODY> <P>Page last updated on: </P> <!--#include virtual="/scripts/modified.asp"--> </BODY> </HTML> </CODE>

Happy Programming!


Attachments:

  • Download modified.asp in Text Format


  • Article Information
    Article Title: User Tip: Obtaining the Last Modified Date of an ASP Page
    Article Author: Scott Mitchell
    Article URL: http://www.4GuysFromRolla.com/webtech/tips/t110699-1.shtml


    Copyright 2014 QuinStreet Inc. All Rights Reserved.
    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers