Add Website last updated to webpage

Posted on 2009-12-22
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
    LVL 15

    Expert Comment


    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

    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)
    LVL 3

    Accepted Solution

    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

    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

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
    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…

    731 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now