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!

Document.LastModified 1

Status
Not open for further replies.

Gamera99

Programmer
May 17, 2001
59
JP
I have been trying to use the javascript "document.lastmodified" statement in my ASPs, but it displays the date and time that the ASP was actually constructed by the server! That isn't what I wanted. I'm unaware of a server variable that shows this info....Does anyone here know a way to show the "last modified" date of an ASP?
Thanks
 
Last-modified is a HTTP Response header and in most cases especially with pages accessing a RDBMS you want this time set to when the page was accessed. In some instances it may be convenient to set this yourself but unfortunately I don't think ASP gives you this ability (someone correct me if I am wrong). Java Servlets and JSP do, maybe you should switch, Ahh the power of Java. Wushutwist
 
Hello,
See if the code below will work for you:

<%
'Get the date last modified
Set fso = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f = fso.GetFile(&quot;c:\Inetpub\ModDate = f.DateLastModified

Response.Write ModDate

'Clean up
ModDate = &quot;&quot;
Set f = Nothing
Set fso = Nothing
%>

Hope this helps.
D.
 
Dianal
That worked great. I used Request.ServerVariable(&quot;PATH_TRANSLATED&quot;) in lieu of the fully qualified path in fso.GetFile and it returned the correct dates for all of my ASPs.
Thanks a lot for your help.
Nelson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top