Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 271192 - Last Review: August 15, 2001 - Revision: 1.0
PRB: JScript "Type Mismatch" Error Occurs After Upgrade to JScript Version 5.5
This article was previously published under Q271192
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.
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();
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 "0" + n;
return n;
}
Date.prototype.toUsaString = function()
{
return (ZeroPad(this.getMonth() + 1)) + "" +
ZeroPad(this.getDate()) + "" +
ZeroPad(this.getFullYear()) + " " +
ZeroPad(this.getHours()) + ":" +
ZeroPad(this.getMinutes()) + ":" +
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.
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 "Thursday, August 10, 2000." This format is not recognized by
Response.ExpiresAbsolute.
APPLIES TO
- Microsoft Active Server Pages 2.0
Retired KB Content DisclaimerThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
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