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

Discussion in 'ASP General' started by What-a-Tool, Jun 29, 2004.

  1. What-a-Tool

    What-a-Tool Guest

    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)
     
    What-a-Tool, Jun 29, 2004
    #1
    1. Advertising

  2. 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:eek:O4Ec.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)
    >
    >
     
    Aaron [SQL Server MVP], Jun 29, 2004
    #2
    1. Advertising

  3. 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-us/iissdk/iis/iis_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-us/iissdk/iis/ref_vbom_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.
     
    Bob Barrows [MVP], Jun 29, 2004
    #3
  4. > 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.)
     
    Aaron [SQL Server MVP], Jun 29, 2004
    #4
  5. What-a-Tool

    What-a-Tool Guest


    > 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
     
    What-a-Tool, Jul 2, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Sloan

    Can someone tell me what this is doing

    Richard Sloan, Jan 8, 2006, in forum: Perl
    Replies:
    1
    Views:
    2,166
    Jon Phipps
    May 19, 2006
  2. =?Utf-8?B?QmlnYWw=?=

    Can someone tell me what is wrong here?

    =?Utf-8?B?QmlnYWw=?=, Aug 11, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    600
    =?Utf-8?B?QmlnYWw=?=
    Aug 12, 2005
  3. Dildo Boy
    Replies:
    6
    Views:
    321
    Flash Gordon
    Mar 6, 2007
  4. E-Dot
    Replies:
    15
    Views:
    527
  5. Cathryn Lindner

    Can someone tell me what I'm doing wrong?

    Cathryn Lindner, Nov 4, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    125
    Cathryn Lindner
    Nov 4, 2003
Loading...

Share This Page