Microsoft KB Archive/271192

= PRB: JScript &quot;Type Mismatch&quot; Error Occurs After Upgrade to JScript Version 5.5 =

Article ID: 271192

Article Last Modified on 8/15/2001

-

APPLIES TO


 * Microsoft Active Server Pages 2.0

-



This article was previously published under Q271192



SYMPTOMS
When a Web server has version 5.5 of the JScript.dll installed, the following error may occur when an Active Server Pages (ASP) page is viewed in a Web browser:

Microsoft JScript runtime (0x800A000D)

Type mismatch

/vdir/page.asp, line 13

Note that the actual line number may vary.



CAUSE
In JScript 5.5, the Date object contains the date in a different format than previous versions of the JScript.dll file did. Existing code that uses the Date object may require the date in the older format, which may cause an error when the date is received in the new format. For example, the ExpiresAbsolute property of the ASP Response object cannot process the new date format. This error can be caused by the following line of code, which is generated by the Commerce Foundation Wizard: Response.ExpiresAbsolute = new Date(new Date.setYear(1980)).toLocaleString;



RESOLUTION
You can follow these steps to resolve this problem:   Add the following JScript server-side code to the top of your ASP page, and then browse to the page in your Web browser to reproduce the error: <%@ Language=JavaScript %> <% function ZeroPad(n) {   if (n < 10) return &quot;0&quot; + n;   return n; }

Date.prototype.toUsaString = function {   return (ZeroPad(this.getMonth + 1)) + &quot;/&quot; + ZeroPad(this.getDate) + &quot;/&quot; + ZeroPad(this.getFullYear) + &quot; &quot; + ZeroPad(this.getHours) + &quot;:&quot; + ZeroPad(this.getMinutes) + &quot;:&quot; + ZeroPad(this.getSeconds); } Response.ExpiresAbsolute = new Date(new Date.setYear(1980)).toLocaleString; %>                     Change the line of code that causes the error from Response.ExpiresAbsolute = new Date(new Date.setYear(1980)).toLocaleString; to: Response.ExpiresAbsolute = new Date(new Date.setYear(1980)).toUsaString; 

NOTE: The toUsaString function can be modified, if necessary, to reflect different date formatting needs.



MORE INFORMATION
Prior to version 5.5, JScript's Date object always contained a date in mm/dd/yyyy format. Additional functionality was introduced with JScript version 5.5 to enable this object to contain the date in a localized format, such as &quot;Thursday, August 10, 2000.&quot; This format is not recognized by Response.ExpiresAbsolute.

Keywords: kbprb KB271192

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.