• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Add Website last updated to webpage

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
0
nmachin
Asked:
nmachin
  • 2
1 Solution
 
rajeeshmcaCommented:
Hi,

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
0
 
nmachinAuthor Commented:
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)
0
 
hsq91Commented:
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:
http://www.communitymx.com/content/article.cfm?page=4&cid=06BF2

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

public static void DisplayFileAttribute(string path)
{
  Console.WriteLine(File.GetLastWriteTime(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]"

DisplayFileAttribute("~/");

You can find out that ~ is the equivalent of PHP's $_SERVER["DOCUMENT_ROOT"] for ASP. NET:
http://msdn.microsoft.com/en-us/library/ms178116.aspx
0
 
nmachinAuthor Commented:
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.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now