Response.Cookies("Name").Expires syntax

Results 1 to 6 of 6

Thread: Response.Cookies("Name").Expires syntax

  1. #1
    Branton Boehm Guest

    Default Response.Cookies("Name").Expires syntax

    I&#039;m trying to set cookies to expire at a later date, so that they&#039;re saved on the users&#039; hard drives. However, I keep getting errors and it&#039;s not working. What form does the date need to be in? (i.e., "8/17/1980", "August 17, 1980", etc.)<BR><BR>Thanks a ton,<BR> Branton

  2. #2
    Devioux Guest

    Default RE: Response.Cookies(

    Response.Cookies("MyCookie").Expires = DateAdd("m",1,Now()) <BR><BR>To expire one month from now...

  3. #3
    Branton Boehm Guest

    Default I'm using JScript

    Probably should&#039;ve mentioned this... but I&#039;m using JScript. (That&#039;s why I posted it in this forum.) Is there a way just as easy as the one you gave in VBScript to do this?

  4. #4
    Join Date
    Dec 1969

    Default RE: I'm using JScript

    as it&#039;s a JScript forum, I can&#039;t think why you were given a VBScript solution.<BR><BR>var d = new Date()<BR>d.setDate(d.getDate()+1)<BR>Response.Coo kies("whatever").expires - d.toString()

  5. #5
    Branton Boehm Guest

    Default Still getting an error

    Thanks for the tip, but I&#039;m still getting an error. Here&#039;s the code & error.<BR><BR>Here&#039;s my code:<BR><BR>var dtmExpires = new Date();<BR>dtmExpires.setDate(dtmExpires.getDate() + 7);<BR>Response.Cookies("User").Expires = dtmExpires.toString();<BR><BR>Here&#039;s my error:<BR>8/1/2001 9:59:35 PM<BR>Microsoft JScript runtime (0x800A000D)<BR>Type mismatch<BR>/Log/processlogin.asp, line 61<BR><BR>Does anyone have any idea what I&#039;m still doing wrong?

  6. #6
    Devioux Guest

    Default RE: I'm using JScript

    Sorry about that - I am new to the scene - all my JS doc references cookies as:<BR>function Cookie(document, name, hours, path, domain, secure){<BR>When I saw your code I immediately thought VB - Ill pay more attention to which board im on in the future...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts