Re: Setting a cookie question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Jim Buyens (news_at_interlacken.com)
Date: 06/28/04


Date: 28 Jun 2004 11:44:40 -0700

Yes, the page sets the cookie for me. I discovered this by:

1. Choosing Internet Options from the Tool menu.
2. On the General Tab, under Temporary Internet
    Files, clicking Settings
3. In the Settings dialog box, clicking View Files.
4. In the resulting Windows Explorer window, clicking
    the Last Modified column heading until that column
    appears in descending order.
5. Searching visually from the top of the list.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------

Steve Grosz <boise_bound@hotmail.com> wrote in message news:<OiDMs#RXEHA.1496@TK2MSFTNGP10.phx.gbl>...
> So, here's the code I have on the main page (or at least the cookie part):
>
> <body>
> <%
> If Request.Cookies("Unique") = "" Then
> Response.Cookies("Unique") = "visited"
> Response.Cookies("Unique").Expires = now() + 30
> End If
> %>
> <p align="center">
> <img src="images/logo1.jpg">
> </p>
>
> And it still doesn't seem to be setting it, even with the browser
> settings set as low as they'll go. Can you see if the page is setting
> it for you? www.scootervilleusa.com
>
> Thanks!
>
> Steve
>
>
>
> Jim Buyens wrote:
>
> >Curious, because this code definitely works on my system.
> >
> >I'd say the next thing to check are your Internet security settings.
> >Make sure you allow cookies for the Web server in question.
> >
> >Jim Buyens
> >Microsoft FrontPage MVP
> >http://www.interlacken.com
> >Author of:
> >*----------------------------------------------------
> >|\---------------------------------------------------
> >|| Microsoft Office FrontPage 2003 Inside Out
> >||---------------------------------------------------
> >|| Web Database Development Step by Step .NET Edition
> >|| Microsoft FrontPage Version 2002 Inside Out
> >|| Faster Smarter Beginning Programming
> >|| (All from Microsoft Press)
> >|/---------------------------------------------------
> >*----------------------------------------------------
> >
> >
> >Steve Grosz <boise_bound@hotmail.com> wrote in message news:<OLOd3t4WEHA.1048@tk2msftngp13.phx.gbl>...
> >
> >
> >>I'm not sure why its not being set then. I have the following code as
> >>the first line on the default.htm page:
> >>
> >><%
> >>If Request.Cookies("beenhere") = "" Then
> >> Response.Cookies("beenhere") = "donethis"
> >> Response.Cookies("beenhere").Expires = now() + 60
> >>End If
> >>%>
> >>
> >>If after posting the page, and then opening my browser and refreshing the page, the cookie should be set on my machine. If I search for the cookie, which I named Visitor instead of "beenhere", I don't find anything with Visitor on my machine.
> >>
> >>Why is that? Do I need to define something in the header file? I have a Javascript line as follows:
> >><script language="JavaScript" type="text/javascript" src="http://www.scootervilleusa.com/Menu/menu_scr.js">
> >>
> >>
> >>Would that be messing things up?
> >>
> >>Steve
> >>
> >>
> >>
> >>Jim Buyens wrote:
> >>
> >>
> >>
> >>>Typically, you would use code like:
> >>>
> >>>If Request.Cookies("beenhere") = "" Then
> >>> Response.Cookies("beenhere") = "donethis"
> >>> Response.Cookies("beenhere").Expires = now() + 60
> >>>End If
> >>>
> >>>The Response.Cookies collection contains cookies that the
> >>>server sends the browser.
> >>>
> >>>The Request.Cookies collection contains cookies that the
> >>>browser sends back to the server.
> >>>
> >>>The statement
> >>> Response.Cookies("beenhere").Expires = now() + 60
> >>>sets the expiration date of the "beenhere" cookie 60 days
> >>>in the future.
> >>>
> >>>Jim Buyens
> >>>Microsoft FrontPage MVP
> >>>http://www.interlacken.com
> >>>Author of:
> >>>*----------------------------------------------------
> >>>|\---------------------------------------------------
> >>>|| Microsoft Office FrontPage 2003 Inside Out
> >>>||---------------------------------------------------
> >>>|| Web Database Development Step by Step .NET Edition
> >>>|| Microsoft FrontPage Version 2002 Inside Out
> >>>|| Faster Smarter Beginning Programming
> >>>|| (All from Microsoft Press)
> >>>|/---------------------------------------------------
> >>>*----------------------------------------------------
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>-----Original Message-----
> >>>>I'm trying to find a way to set a cookie if it doesn't
> >>>>exist.
> >>>>
> >>>>I know with ColdFusion there are some good programming
> >>>>controls and commands, but not sure about ASP.
> >>>>
> >>>>Would something like this work?
> >>>>
> >>>><%
> >>>>If Not Exists("beenhere")
> >>>>Response.Cookies("beenhere") = "donethis"
> >>>>Response.Cookies("beenhere").Expires = "July 31, 2004"
> >>>>%>
> >>>>
> >>>>What I'm trying to do is check to see if the cookie
> >>>>exists, if not, set it.
> >>>>
> >>>>I also know that with ColdFusion you don't have to
> >>>>specify a actual end date, you can do it in number of
> >>>>days, can you do that with ASP?
> >>>>
> >>>>Thanks,
> >>>>Steve
> >>>>.
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>



Relevant Pages

  • Re: Cookies - how to delete?
    ... In Internet Explorer, on the Tools menu, click Internet Options. ... On the General tab, click Settings, and then click View files. ... Select the cookie you want to delete, and then, on the File menu, click Delete. ...
    (microsoft.public.windowsxp.general)
  • Cookies - how to delete?
    ... In Internet Explorer, on the Tools menu, click Internet Options. ... On the General tab, click Settings, and then click View files. ... Select the cookie you want to delete, and then, on the File menu, click ...
    (microsoft.public.windowsxp.general)
  • RE: Group Policy Connundrum - Stick with it, its confusing!!!
    ... Applied Group Policy Objects ... Small Business Server Internet Connection Firewall ... Secure Proxy Server: 0.0.0.0:80 ... Import the current Content Ratings Settings: ...
    (Security-Basics)
  • RE: WINDOWS DOES NOT REMEMBER LOGON CREDENTIALS
    ... On the Internet E-mail settings where you insert the POP3/IMAP/SMTP under ... By looking on the Permission assigned you can adjust it to give the Admin ... Double-click the Protected Storage System Provider key to expand the key, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Won,t Update
    ... I couldn,t rename the software distribution folder. ... Clearing Temporary Internet files, cookies and history in Internet Explorer ... Please note that Security settings in Internet Explorer must be set to Medium or ...
    (microsoft.public.windowsupdate)