Connecting Tech Pros Worldwide Forums | Help | Site Map

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

What-a-Tool
Guest
 
Posts: n/a
#1: Jul 19 '05
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)



Aaron [SQL Server MVP]
Guest
 
Posts: n/a
#2: Jul 19 '05

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


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" <Die!FrigginSpammersDieDie!@IHateSpam.Net> wrote in message
news:oO4Ec.6454$mN3.4511@lakeread06...[color=blue]
> 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[/color]
it[color=blue]
> 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") ==[/color]
""))[color=blue]
> {
> %>
>
> <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();
> -)
>
> --------------------------------------------------------------------------[/color]
--[color=blue]
> -
> 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)
>
>[/color]


Bob Barrows [MVP]
Guest
 
Posts: n/a
#3: Jul 19 '05

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


What-a-Tool wrote:[color=blue]
> 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!?[/color]
<snip>[color=blue]
>
> 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();
> -)
>[/color]

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.


Aaron [SQL Server MVP]
Guest
 
Posts: n/a
#4: Jul 19 '05

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


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


Bob Barrows [MVP]
Guest
 
Posts: n/a
#5: Jul 19 '05

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


Aaron [SQL Server MVP] wrote:[color=blue][color=green]
>> You will see that "expires" needs to be "Expires"[/color]
>
> 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.
>[/color]
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.


Aaron [SQL Server MVP]
Guest
 
Posts: n/a
#6: Jul 19 '05

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


> That is a surprise. I wonder why? Could it be creating a new attribute
with[color=blue]
> the value supplied?[/color]

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


What-a-Tool
Guest
 
Posts: n/a
#7: Jul 19 '05

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


[color=blue]
> HELP- PLEASE!?
>[/color]
[color=blue]
> 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();
> -)[/color]

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


Closed Thread