Friday, May 1, 2009

Displaying last modified date of page.

Using System.IO Name space we can find out time when page was last modified. we can also display LastWriteTime,CreationTime etc. of page. here if the code to display LastAccssTime of page.

string filePath = Server.MapPath(Request.Path);
System.IO.FileInfo fInfo = new System.IO.FileInfo(filePath);
lblLastWriteTime.Text = fInfo.CreationTime.ToString();

Put this code in Page_Load event of your page.