Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Help - Can someone please tell me what I'm doing wrong here?

Reply
Thread Tools

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

 
 
What-a-Tool
Guest
Posts: n/a
 
      06-29-2004
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)


 
Reply With Quote
 
 
 
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      06-29-2004
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
newsO4Ec.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)
>
>



 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      06-29-2004
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.


 
Reply With Quote
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      06-29-2004
> 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.)


 
Reply With Quote
 
What-a-Tool
Guest
Posts: n/a
 
      07-02-2004

> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can someone please tell me where I am going wrong?? E-Dot C Programming 15 03-13-2007 03:08 AM
Can someone please tell me where I am going wrong?? Dildo Boy C Programming 6 03-06-2007 04:48 AM
Can someone tell me what this is doing Richard Sloan Perl 1 05-19-2006 01:59 PM
Please tell me what I'm doing wrong xeys_00 C++ 6 04-10-2005 11:08 AM
Can someone tell me what I'm doing wrong? Cathryn Lindner ASP .Net Web Controls 0 11-04-2003 10:16 PM



Advertisments