By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,627 Members | 2,244 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,627 IT Pros & Developers. It's quick & easy.

Help - Can someone please tell me what I'm doing wrong here?

P: n/a
I'm going out out of my mind trying to get this to work with no luck. The
error message I get is at the bottom. Can someone please tell me what I'm
doing wrong here. I've tried this a million different ways and can't get it
to work. I can get it to work with VBScript, but I need to do this project
in JavaScript. HELP- PLEASE!?

<%@Language=JavaScript%>
<%Response.buffer=true%>

<%
if(Request.Form("txtusername") == "" || (Request.Form("txtpassword") == ""))
{
%>

<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="en-us">
<title>Error Information</title>
</HEAD>
<BODY>

<Some HTML text Here>
<%
}
else
{

ExpireDate = new Date();
ExpireDate.setYear = (ExpireDate.getYear() + 1);

Response.Cookies("User").expires = ExpireDate.toLocaleString();

Response.Cookies("User")("UName") = Request.Form("txtusername");
Response.Cookies("User")("Pword") = Request.Form("txtpassword");

Response.Redirect("chapt8default2.asp")

Response.End

}
%>

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/aspchapt8/auth.asp, line 47 (this is line
47 -Response.Cookies("User").expires = ExpireDate.toLocaleString();
-)

----------------------------------------------------------------------------
-
Thanks in Advance for any help given

--

/ Sean the Mc /
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)
Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Have you tried using a standard date instead of a proprietary getLocale()
date? This worked fine for me:

<script language=jscript runat=server>

var ed = new Date();
var dStr = getISOdate(ed);

Response.Write(dStr);
Response.Cookies("User")("UName") = "blah";
Response.Cookies("User").Expires = dStr;

function getISOdate(d)
{
var dStr = d.getFullYear() + '-'
dStr += (ed.getMonth()<9) ? '0' : '';
dStr += (ed.getMonth()+1) + '-';
dStr += (ed.getDate()<10) ? '0' : '';
dStr += (ed.getDate());
return dStr;
}

</script>

--
http://www.aspfaq.com/
(Reverse address to reply.)


"What-a-Tool" <Di************************@IHateSpam.Net> wrote in message
news:oO4Ec.6454$mN3.4511@lakeread06...
I'm going out out of my mind trying to get this to work with no luck. The
error message I get is at the bottom. Can someone please tell me what I'm
doing wrong here. I've tried this a million different ways and can't get it to work. I can get it to work with VBScript, but I need to do this project
in JavaScript. HELP- PLEASE!?

<%@Language=JavaScript%>
<%Response.buffer=true%>

<%
if(Request.Form("txtusername") == "" || (Request.Form("txtpassword") == "")) {
%>

<HTML>
<HEAD>
<meta http-equiv="Content-Language" content="en-us">
<title>Error Information</title>
</HEAD>
<BODY>

<Some HTML text Here>
<%
}
else
{

ExpireDate = new Date();
ExpireDate.setYear = (ExpireDate.getYear() + 1);

Response.Cookies("User").expires = ExpireDate.toLocaleString();

Response.Cookies("User")("UName") = Request.Form("txtusername");
Response.Cookies("User")("Pword") = Request.Form("txtpassword");

Response.Redirect("chapt8default2.asp")

Response.End

}
%>

Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/aspchapt8/auth.asp, line 47 (this is line
47 -Response.Cookies("User").expires = ExpireDate.toLocaleString();
-)

-------------------------------------------------------------------------- -- -
Thanks in Advance for any help given

--

/ Sean the Mc /
"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

Jul 19 '05 #2

P: n/a
What-a-Tool wrote:
I'm going out out of my mind trying to get this to work with no luck.
The error message I get is at the bottom. Can someone please tell me
what I'm doing wrong here. I've tried this a million different ways
and can't get it to work. I can get it to work with VBScript, but I
need to do this project in JavaScript. HELP- PLEASE!? <snip>
Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/aspchapt8/auth.asp, line 47 (this is line
47 -Response.Cookies("User").expires = ExpireDate.toLocaleString();
-)


JScript, as opposed to VBScript, is case-sensitive. You are going to need
keep a link to the online documentation handy so you can verify which
letters need to be capitalized. This is the starting point:
http://msdn.microsoft.com/library/en..._web_pages.asp

Let's look at the line causing the error:
Response.Cookies("User").expires = ExpireDate.toLocaleString();
Follow the Built-in Objects link get to the page from which you can follow
the Response Object link to finally reach here:
http://msdn.microsoft.com/library/en..._resoccook.asp

You will see that "expires" needs to be "Expires"

HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3

P: n/a
> You will see that "expires" needs to be "Expires"

I meant to note that it was the first piece of the code that I changed, but
on my machine at least, expires and Expires seemed to perform equally well.

What fixed the problem for me (though I was getting Type Mismatch) was using
a sensible date format.

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #4

P: n/a
Aaron [SQL Server MVP] wrote:
You will see that "expires" needs to be "Expires"


I meant to note that it was the first piece of the code that I
changed, but on my machine at least, expires and Expires seemed to
perform equally well.

That is a surprise. I wonder why? Could it be creating a new attribute with
the value supplied?

Bob
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5

P: n/a
> That is a surprise. I wonder why? Could it be creating a new attribute
with
the value supplied?


Maybe it's just passing the attribute to the client, and not trying to
actually "implement" it within the JavaScript code...

Though, when I tried Response.Cookies("User").blat = something I got the
aforementioned 800a01b6 error.

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #6

P: n/a
HELP- PLEASE!?
Microsoft JScript runtime error '800a01b6'

Object doesn't support this property or method

/aspchapt8/auth.asp, line 47 (this is line
47 -Response.Cookies("User").expires = ExpireDate.toLocaleString();
-)


Just want to say thanks.
I got it working by re-formatting my date string as suggested, and now it
works as advertised by my text book.
Thanks for taking the time!

Sean
Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.