Microsoft Knowledge Base Email Alertz

KBAlertz.com: (165862) - The lastModified property that the Internet Explorer HTML scripting object model exposes indicates the date and time at which the sender believes the resource was last modified. When this property is referenced in a page that the Active Server Page...

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]

Search KbAlertz

Advanced Search

Webmasters
Put kbAlertz on your website.
[ Click Here for more! ]





ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **


Community Site



We Send hundreds of thousands of emails using ASP.NET Email


ASP.NET 3.5 Web Hosting with Windows 2008 and SQL 2008: Click Here!
Discount ASP.NET Hosting
ASP.NET 2.0 and 3.5
Windows2008 and SQL2008
US and UK Hosting
KBAlertz referrals get
** SIX MONTHS FREE **




Mentioned In








Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks




Article ID: 165862 - Last Review: July 3, 2008 - Revision: 6.0

PRB: document.lastModified Property Is Unreadable with ASP

This article was previously published under Q165862
We strongly recommend that all users upgrade to Microsoft Internet Information Services (IIS) version 7.0 running on Microsoft Windows Server 2008. IIS 7.0 significantly increases Web infrastructure security. For more information about IIS security-related topics, visit the following Microsoft Web site:
http://www.microsoft.com/technet/security/prodtech/IIS.mspx (http://www.microsoft.com/technet/security/prodtech/IIS.mspx)
For more information about IIS 7.0, visit the following Microsoft Web site:
http://www.iis.net/default.aspx?tabid=1 (http://www.iis.net/default.aspx?tabid=1)

On This Page

SYMPTOMS

The lastModified property that the Internet Explorer HTML scripting object model exposes indicates the date and time at which the sender believes the resource was last modified. When this property is referenced in a page that the Active Server Page (ASP) framework generates, the client browser displays an unreadable value.

CAUSE

The ASP framework does not include the Last-Modified response header in its response to the client.

RESOLUTION

According 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.

Active 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, Internet Explorer, expects times to be expressed in Greenwich Mean Time (GMT). Although Microsoft Visual Basic Scripting Edition (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 code:
   <%@ 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.

STATUS

Microsoft has confirmed that this is a problem in Internet Explorer versions 3.0 and 3.01.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new ASP page named baddate.asp, and paste the following HTML code:
       <HTML>
       <BODY>
       <SCRIPT LANGUAGE=VBSCRIPT>
       document.write "Last Modified on " & document.lastModified
       </SCRIPT>
       </BODY>
       </HTML>
    
    					
  2. Save baddate.asp in a directory that corresponds to a Virtual Root in IIS. Make sure that the Virtual Root has been granted Execute permissions in IIS.
  3. Start Internet Explorer, and type the following URL, which points to this page, in the Address box:
    http://<server>/<vroot_name>/baddate.asp
  4. Observe that the date appears to be corrupted.

REFERENCES

RFC 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/search/default.aspx?qu=vinterdev (http://support.microsoft.com/search/default.aspx?qu=vinterdev)

APPLIES TO
  • Microsoft Active Server Pages 4.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0
Keywords: 
kbcodesnippet kbprb kbscript KB165862
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate

Be the first to leave feedback, to help others about this knowledge base article.

(Optional) Name

(Optional) Public URL Or Email

Comments
No HTML -- Text Only Please