PRB: document.lastModified Property is Unreadable with ASPLast reviewed: December 11, 1997Article ID: Q165862 |
The information in this article applies to:
SYMPTOMSThe lastModified property exposed by the Internet Explorer (IE) HTML scripting object model indicates the date and time at which the sender believes the resource was last modified. When this property is referenced in a page generated by the Active Server Page framework, an unreadable value is displayed by the client browser.
CAUSEThe Active Server Page framework does not include the Last-Modified response header in its response to the client.
RESOLUTIONAccording to RFC 1945, Hypertext Transfer Protocol 1.0 -- HTTP/1.0, Last-Modified is an entity header field, and entity header fields are optional. Internet Explorer 3.0 does not handle the absence of this header gracefully.
STATUSMicrosoft has confirmed this to be a problem in Internet Explorer versions 3.0 and 3.01.
MORE INFORMATION
Steps to Reproduce Behavior
RESOLUTIONActive Server Pages provides the Response Intrinsic object. Use the Response.AddHeader method to add the Last-Modified header to the HTTP response. According to the RFC, the user agent, IE, expects times to be expressed in Greenwich Mean Time (GMT). While VBSCRIPT does provide many date and time manipulation functions, it does not provide a function to return GMT or a function to return the current time zone offset from which GMT could be derived. The following example uses JSCRIPT on the server to append the Last-Modified response header to those provided by IIS and the Active Server Page Framework. Replace the contents of the page above with the following text:
<%@ LANGUAGE=JSCRIPT %> <% // JSCRIPT automatically formats the string as specified // in RFC 1945, HTTP/1.0 // e.g. Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT theCurrentTime = new Date() // convert the date to GMT theUTCLastModifiedTime = theCurrentTime.toGMTString() // Inject the header into the HTTP response Response.AddHeader("Last-modified", theUTCLastModifiedTime) %> <HTML> <BODY> <SCRIPT LANGUAGE=VBSCRIPT> document.write "Last Modified on " & document.lastModified </SCRIPT> </BODY> </HTML>Save the ASP file on the server, and refresh the page in the client browser. The last modified date should now be displayed correctly.
REFERENCESRFC 1945. Hypertext Transfer Protocol 1.0 -- HTTP/1.0. On-line Active Server Pages documentation. For the latest Knowledge Base articles and other support information on Visual InterDev and Active Server Pages, see the following page on the Microsoft Technical Support site:
http://support.microsoft.com/support/vinterdev/ Keywords : kbprb Version : 1.0 3.01 Platform : NT WINDOWS Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |