Results 1 to 8 of 8

Thread: cookies - vbscript - client side

  1. #1

    Thread Starter
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232

    cookies - vbscript - client side

    How do I get and/or set cookies using client-side VB script?

  2. #2
    New Member
    Join Date
    Jun 2001
    Location
    bucharest
    Posts
    5
    dont try this, cookies are good for server side only.

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Cookies are set through the Response object which is server side only.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  4. #4

    Thread Starter
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232
    thanks for the response, but that's not what i expected i'm affraid.

    what i want to achieve is that to not bother to go to the server if the cookie is not there anyway....

    client-side cookie handling is possible using javascript, so i presume that vbscript should be able to do the same...

    anyone?

  5. #5
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    VBScript generally uses the same Object Model as Javascript/JScript, just the syntax is different.

    From MSDN:

    Code:
    <SCRIPT LANGUAGE="VBSCRIPT">
          Sub SetCookie
            document.cookie = "MyVar='101'; path='page1-2.htm'"
          End Sub
        </SCRIPT>
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  6. #6
    Lively Member
    Join Date
    Aug 2000
    Location
    South Africa
    Posts
    113

    Thumbs up Now im confused

    Okay, if u need the cookie stuff done on the client side, then what is wrong with using Javascript?

    Its as simple as document.cookie
    all u do is make it equal to a string with the variable u need in the cooke and the date...to know when the cookie expires.

    I can put all the code here if u want. Just don't remember it off hand.

    But lemme know why u want to use VBscript for something that as far as I know Javascript is more than adeopt at handling?
    You are living a pacifist dream, and if you dreaming it means you sleeping and you should damn well wake up!

  7. #7

    Thread Starter
    Addicted Member pardede's Avatar
    Join Date
    Jan 2000
    Posts
    232
    Well, i need to use vbscript because i'm writing an intranet application for users using IE5 up, and it need to do some stuff on the client machine. Since it's intranet, the security is set to allow this. Javascript does not have the possibility to do stuff on the client machine. That's why.

    By the way, thanx JoshT for the setcookie code, is there one also for [b]get[b]cookie?

    cheers

  8. #8
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    You're welcome. Not off hand, but if you have an example using client side javascript, all you'd have to do is modify the syntax for vbscript.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

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



Click Here to Expand Forum to Full Width