Add Website last updated to webpage

Posted on 2009-12-22
Medium Priority
Last Modified: 2013-12-17
Is there a way to display when the website was last modified?  Everything that I am finding shows when a page is modified.  I need to be able to display on the home page the most recent date when any of the pages in the website is modified ....
page2.aspx is updated, default.aspx will show the modified date of page2.aspx
page2.aspx & page3.aspx are updated, the most recent update between those pages are displayed on default.aspx

thanks for your help
Question by:nmachin
  • 2
LVL 15

Expert Comment

ID: 26106718

for this you can do one thing is.. you can maintain a seperate table for handling the recent Date. whenever any insert or update is done to any of the other tables or fields , then you can trigger an event to inset the recent date to the table that maintains the recent date...

If you find any other method.. please post me

Author Comment

ID: 26107082
I've been seaching but have came across much.  Your method is what we do for database updates but doesn't cover if the html page is changed (ie new graphics added)

Accepted Solution

hsq91 earned 2000 total points
ID: 26108514
The simplest way to determine when the whole Web Site was last updated (according the Server's local timezone) is to query the Site's root folder's last-modified time with server-side languages.

For example, with PHP, I can query my Site's root folder like this:

<?php echo "Web Site last updated on ".date("m-d-Y H:i:s",filemtime($_SERVER["DOCUMENT_ROOT"]));?>

The Site's root folder's last-modified time will typically get updated whenever you create, modify/rename, move, or delete any type of sub file/folder inside your whole Site's root folder!

You can then search for other server-side languages' technique of getting the modified time of the Site's root folder.

For example, here's what I found by google-ing for ASP.NET's technique:

"The following example displays the files timestamp for the last time it was written to [or last modified]:"

public static void DisplayFileAttribute(string path)

"This method could be used by calling the above mentioned code and setting the path equal to the the path and name of the file that should be modified. Paths may be referenced by the relative path or an absolute path along with the name of the file. As in the following: [with my modification]"


You can find out that ~ is the equivalent of PHP's $_SERVER["DOCUMENT_ROOT"] for ASP. NET:

Author Comment

ID: 26112085
I think that's what I'm looking for!!!

string sPath = Server.MapPath("~");
DateTime dt = File.GetLastWriteTime(sPath);
lblBottom.Text = "Site Last Updated " + dt.ToString();

I was trying  ...
string sPath = Request.ServerVariables["Path_Translated"];
which was only giving me the files.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question