Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extremely weird behavior 1

Status
Not open for further replies.

Rydel

Programmer
Feb 5, 2001
376
CZ
Code:
<script>
document.write(&quot;This page was last updated on &quot;)
document.write(document.lastModified)
</script>

The above code is contained in footer.inc which gets included to every ASP page on the Web site via SSI (<!-- #include file=&quot;footer.inc&quot; -->). Instead of lastModified date it seems the above script always prints the time when the document got last loaded. Weird... Any help greatly appreciated. I think there was SSI command for that, which should work, but I don't remember the name of it.
---
---
 
Actually, I found the SSI command:

Code:
<!--#echo var=&quot;LAST_MODIFIED&quot;-->

But it doesn't display anything, even though #include works fine (I am running IIS). So is there a way to accomplish it through JavaScript? ---
---
 
I'm not sure you're going to be able to do this properly. The reason your VBScript returned the last time the page was loaded was because ASP re-compiles each time you get a new request for that page. In essence, it is re-creating the page each time the page is called. I don't think any client-side scripting such VBScript or JavaScript can help you. They are reporting the creation fine as the computer sees it.

If you really want to do this, your best bet is to use the FileSystemObject. You can get a File object like so:

set FSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Path = Server.MapPath(&quot;page1.asp&quot;)
set oFile = FSO.GetFile(Path)
DateLastModifiedString = oFile.DateLastModified
set oFile = nothing
set FSO = nothing

and so forth.

Hope that helps some.

This Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top