When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
ASPFAQs.com
Message Board
Related Web Technologies
User Tips!
Coding Tips

Sections:
Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Security
Stump the SQL Guru!
XML Info
Information:
Feedback
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
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


  • ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article