Storing Cookies

Discussion in 'ASP General' started by Brian Burgess, Sep 10, 2003.

  1. Hi all,

    Anyone know of any special issues with storing cookies with ASP? I'm
    trying this with two browsers: One is IE 6.0 with cookies set to
    'prompt'. This has been working properly as any new site I goto seems
    to prompt me to store their cookie. The other is Pocket IE on Pocket
    PC 2002, with the cookies set to 'enabled'.

    My problem is that the cookies dont seem to be being written with my
    ASP. I dont get the prompt to store the cookie when I should. My
    storage code looks like this:

    Response.Cookies("AcctNbr") = nAcctNbr
    Response.Cookies("MsgStart") = nMsgStart
    Response.Cookies("MsgEnd") = nMsgEnd
    Response.Cookies("AcctNbr").Expires = DateAdd("h", 15, Now)
    Response.Cookies("MsgStart").Expires = DateAdd("h", 15, Now)
    Response.Cookies("MsgEnd").Expires = DateAdd("h", 15, Now)


    And the read code looks like this:

    If Not(Request.Cookies("AcctNbr")="") Then
    nAcctNbr = CInt(Request.Cookies("AcctNbr"))
    End If
    If Not(Request.Cookies("MsgStart")="") Then
    nMsgStart = CInt(Request.Cookies("MsgStart"))
    End If
    If Not(Request.Cookies("MsgEnd")="") Then
    nMsgEnd = CInt(Request.Cookies("MsgEnd"))
    End If


    Of course nothing is read in, but past that, my browser does not
    prompt for storage either..

    Any ideas?

    Thanks in advance...

    -BB
    Brian Burgess, Sep 10, 2003
    #1
    1. Advertising

  2. Hi Brian,

    You asked if ASP does something special with cookies. No, it sends them to
    the browser in the normal manner.

    You also wrote that you verified that IE6 is receiving cookies from sites
    that you visit, but it appears that pocket IE is not receiving cookies.

    When you visit your own web page with IE6 multiple times in a row, does it
    receive the values from the cookies? Can you repeat this with Pocket IE? I
    think the error is with Pocket IE rather than with the web site.

    Thank you, Mike
    Microsoft, ASP.NET

    Microsoft Security Announcement: Have you installed the patch for Microsoft
    Security Bulletin MS03-039? If not, Microsoft strongly advises you to
    review the information at the following link regarding Microsoft Security
    Bulletin MS03-039
    http://www.microsoft.com/technet/security/bulletin/ms03-039.asp and/or to
    visit Windows Update at http://windowsupdate.microsoft.com to install the
    patch. Running the Windows Update scan will help to insure you are current
    with all security patches, not just MS03-039.

    Microsoft also highly recommends to all customers that you visit the
    http://www.microsoft.com/protect site and perform the three straightforward
    steps listed to improve your computer’s security.

    This posting is provided "AS IS", with no warranties, and confers no rights.


    --------------------
    > From: Brian Burgess <>
    > Subject: Storing Cookies
    > Date: Wed, 10 Sep 2003 10:14:59 +0800
    > Message-ID: <>
    > X-Newsreader: Forte Free Agent 1.92/32.572
    > MIME-Version: 1.0
    > Content-Type: text/plain; charset=us-ascii
    > Content-Transfer-Encoding: 7bit
    > Newsgroups: microsoft.public.inetserver.asp.general
    > NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
    > Lines: 1
    > Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    > Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252150
    > X-Tomcat-NG: microsoft.public.inetserver.asp.general
    >
    > Hi all,
    >
    > Anyone know of any special issues with storing cookies with ASP? I'm
    > trying this with two browsers: One is IE 6.0 with cookies set to
    > 'prompt'. This has been working properly as any new site I goto seems
    > to prompt me to store their cookie. The other is Pocket IE on Pocket
    > PC 2002, with the cookies set to 'enabled'.
    >
    > My problem is that the cookies dont seem to be being written with my
    > ASP. I dont get the prompt to store the cookie when I should. My
    > storage code looks like this:
    >
    > Response.Cookies("AcctNbr") = nAcctNbr
    > Response.Cookies("MsgStart") = nMsgStart
    > Response.Cookies("MsgEnd") = nMsgEnd
    > Response.Cookies("AcctNbr").Expires = DateAdd("h", 15, Now)
    > Response.Cookies("MsgStart").Expires = DateAdd("h", 15, Now)
    > Response.Cookies("MsgEnd").Expires = DateAdd("h", 15, Now)
    >
    >
    > And the read code looks like this:
    >
    > If Not(Request.Cookies("AcctNbr")="") Then
    > nAcctNbr = CInt(Request.Cookies("AcctNbr"))
    > End If
    > If Not(Request.Cookies("MsgStart")="") Then
    > nMsgStart = CInt(Request.Cookies("MsgStart"))
    > End If
    > If Not(Request.Cookies("MsgEnd")="") Then
    > nMsgEnd = CInt(Request.Cookies("MsgEnd"))
    > End If
    >
    >
    > Of course nothing is read in, but past that, my browser does not
    > prompt for storage either..
    >
    > Any ideas?
    >
    > Thanks in advance...
    >
    > -BB
    >
    Mike Moore [MSFT], Sep 10, 2003
    #2
    1. Advertising

  3. Well I have my IE60 set to prompt to accept all cookies. And I have
    tried a sample cookie setting and reading page from the CodeProject.
    This works and prompts me on my IE60 to save the cookie. .. It IS
    something I'm doing wrong in my ASP .. just cant figure out what ..
    :-(

    On Wed, 10 Sep 2003 20:38:06 GMT, ("Mike
    Moore [MSFT]") wrote:

    >Hi Brian,
    >
    >You asked if ASP does something special with cookies. No, it sends them to
    >the browser in the normal manner.
    >
    >You also wrote that you verified that IE6 is receiving cookies from sites
    >that you visit, but it appears that pocket IE is not receiving cookies.
    >
    >When you visit your own web page with IE6 multiple times in a row, does it
    >receive the values from the cookies? Can you repeat this with Pocket IE? I
    >think the error is with Pocket IE rather than with the web site.
    >
    >Thank you, Mike
    >Microsoft, ASP.NET
    >
    >Microsoft Security Announcement: Have you installed the patch for Microsoft
    >Security Bulletin MS03-039? If not, Microsoft strongly advises you to
    >review the information at the following link regarding Microsoft Security
    >Bulletin MS03-039
    >http://www.microsoft.com/technet/security/bulletin/ms03-039.asp and/or to
    >visit Windows Update at http://windowsupdate.microsoft.com to install the
    >patch. Running the Windows Update scan will help to insure you are current
    >with all security patches, not just MS03-039.
    >
    >Microsoft also highly recommends to all customers that you visit the
    >http://www.microsoft.com/protect site and perform the three straightforward
    >steps listed to improve your computer’s security.
    >
    >This posting is provided "AS IS", with no warranties, and confers no rights.
    >
    >
    >--------------------
    >> From: Brian Burgess <>
    >> Subject: Storing Cookies
    >> Date: Wed, 10 Sep 2003 10:14:59 +0800
    >> Message-ID: <>
    >> X-Newsreader: Forte Free Agent 1.92/32.572
    >> MIME-Version: 1.0
    >> Content-Type: text/plain; charset=us-ascii
    >> Content-Transfer-Encoding: 7bit
    >> Newsgroups: microsoft.public.inetserver.asp.general
    >> NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
    >> Lines: 1
    >> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    >> Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252150
    >> X-Tomcat-NG: microsoft.public.inetserver.asp.general
    >>
    >> Hi all,
    >>
    >> Anyone know of any special issues with storing cookies with ASP? I'm
    >> trying this with two browsers: One is IE 6.0 with cookies set to
    >> 'prompt'. This has been working properly as any new site I goto seems
    >> to prompt me to store their cookie. The other is Pocket IE on Pocket
    >> PC 2002, with the cookies set to 'enabled'.
    >>
    >> My problem is that the cookies dont seem to be being written with my
    >> ASP. I dont get the prompt to store the cookie when I should. My
    >> storage code looks like this:
    >>
    >> Response.Cookies("AcctNbr") = nAcctNbr
    >> Response.Cookies("MsgStart") = nMsgStart
    >> Response.Cookies("MsgEnd") = nMsgEnd
    >> Response.Cookies("AcctNbr").Expires = DateAdd("h", 15, Now)
    >> Response.Cookies("MsgStart").Expires = DateAdd("h", 15, Now)
    >> Response.Cookies("MsgEnd").Expires = DateAdd("h", 15, Now)
    >>
    >>
    >> And the read code looks like this:
    >>
    >> If Not(Request.Cookies("AcctNbr")="") Then
    >> nAcctNbr = CInt(Request.Cookies("AcctNbr"))
    >> End If
    >> If Not(Request.Cookies("MsgStart")="") Then
    >> nMsgStart = CInt(Request.Cookies("MsgStart"))
    >> End If
    >> If Not(Request.Cookies("MsgEnd")="") Then
    >> nMsgEnd = CInt(Request.Cookies("MsgEnd"))
    >> End If
    >>
    >>
    >> Of course nothing is read in, but past that, my browser does not
    >> prompt for storage either..
    >>
    >> Any ideas?
    >>
    >> Thanks in advance...
    >>
    >> -BB
    >>
    Brian Burgess, Sep 11, 2003
    #3
  4. Brian Burgess

    BrianJian Guest

    What 's the value of nAcctNbr,nMsgStart,nMsgEnd?
    This is where the problem exists.

    "Brian Burgess" <>
    ??????:...
    > Hi all,
    >
    > Anyone know of any special issues with storing cookies with ASP? I'm
    > trying this with two browsers: One is IE 6.0 with cookies set to
    > 'prompt'. This has been working properly as any new site I goto seems
    > to prompt me to store their cookie. The other is Pocket IE on Pocket
    > PC 2002, with the cookies set to 'enabled'.
    >
    > My problem is that the cookies dont seem to be being written with my
    > ASP. I dont get the prompt to store the cookie when I should. My
    > storage code looks like this:
    >
    > Response.Cookies("AcctNbr") = nAcctNbr
    > Response.Cookies("MsgStart") = nMsgStart
    > Response.Cookies("MsgEnd") = nMsgEnd
    > Response.Cookies("AcctNbr").Expires = DateAdd("h", 15, Now)
    > Response.Cookies("MsgStart").Expires = DateAdd("h", 15, Now)
    > Response.Cookies("MsgEnd").Expires = DateAdd("h", 15, Now)
    >
    >
    > And the read code looks like this:
    >
    > If Not(Request.Cookies("AcctNbr")="") Then
    > nAcctNbr = CInt(Request.Cookies("AcctNbr"))
    > End If
    > If Not(Request.Cookies("MsgStart")="") Then
    > nMsgStart = CInt(Request.Cookies("MsgStart"))
    > End If
    > If Not(Request.Cookies("MsgEnd")="") Then
    > nMsgEnd = CInt(Request.Cookies("MsgEnd"))
    > End If
    >
    >
    > Of course nothing is read in, but past that, my browser does not
    > prompt for storage either..
    >
    > Any ideas?
    >
    > Thanks in advance...
    >
    > -BB
    BrianJian, Sep 12, 2003
    #4
  5. Hi Brian,

    I'd like to return to basics for this. Please start a new blank page and
    add this code. Then browse it and then refresh the page with IE and Pocket
    IE. Then post the results.
    <%
    Response.Write Request.Cookies("abc")
    Response.Cookies("abc") = "123"
    Response.CacheControl="no-cache"
    %>

    Thank you, Mike
    Microsoft, ASP.NET

    Microsoft highly recommends to all of our customers that they visit the
    http://www.microsoft.com/protect site and perform the three straightforward
    steps listed to improve your computer’s security.

    This posting is provided "AS IS", with no warranties, and confers no rights.


    --------------------
    > From: Brian Burgess <>
    > Subject: Re: Storing Cookies
    > Date: Thu, 11 Sep 2003 08:31:49 +0800
    > Message-ID: <>
    > References: <>

    <>
    > X-Newsreader: Forte Free Agent 1.92/32.572
    > MIME-Version: 1.0
    > Content-Type: text/plain; charset=ISO-8859-1
    > Content-Transfer-Encoding: 8bit
    > Newsgroups: microsoft.public.inetserver.asp.general
    > NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
    > Lines: 1
    > Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
    > Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:252315
    > X-Tomcat-NG: microsoft.public.inetserver.asp.general
    >
    > Well I have my IE60 set to prompt to accept all cookies. And I have
    > tried a sample cookie setting and reading page from the CodeProject.
    > This works and prompts me on my IE60 to save the cookie. .. It IS
    > something I'm doing wrong in my ASP .. just cant figure out what ..
    > :-(
    >
    > On Wed, 10 Sep 2003 20:38:06 GMT, ("Mike
    > Moore [MSFT]") wrote:
    >
    > >Hi Brian,
    > >
    > >You asked if ASP does something special with cookies. No, it sends them

    to
    > >the browser in the normal manner.
    > >
    > >You also wrote that you verified that IE6 is receiving cookies from

    sites
    > >that you visit, but it appears that pocket IE is not receiving cookies.
    > >
    > >When you visit your own web page with IE6 multiple times in a row, does

    it
    > >receive the values from the cookies? Can you repeat this with Pocket IE?

    I
    > >think the error is with Pocket IE rather than with the web site.
    > >
    > >Thank you, Mike
    > >Microsoft, ASP.NET
    > >
    > >Microsoft Security Announcement: Have you installed the patch for

    Microsoft
    > >Security Bulletin MS03-039? If not, Microsoft strongly advises you to
    > >review the information at the following link regarding Microsoft

    Security
    > >Bulletin MS03-039
    > >http://www.microsoft.com/technet/security/bulletin/ms03-039.asp and/or

    to
    > >visit Windows Update at http://windowsupdate.microsoft.com to install

    the
    > >patch. Running the Windows Update scan will help to insure you are

    current
    > >with all security patches, not just MS03-039.
    > >
    > >Microsoft also highly recommends to all customers that you visit the
    > >http://www.microsoft.com/protect site and perform the three

    straightforward
    > >steps listed to improve your computer’s security.
    > >
    > >This posting is provided "AS IS", with no warranties, and confers no

    rights.
    > >
    > >
    > >--------------------
    > >> From: Brian Burgess <>
    > >> Subject: Storing Cookies
    > >> Date: Wed, 10 Sep 2003 10:14:59 +0800
    > >> Message-ID: <>
    > >> X-Newsreader: Forte Free Agent 1.92/32.572
    > >> MIME-Version: 1.0
    > >> Content-Type: text/plain; charset=us-ascii
    > >> Content-Transfer-Encoding: 7bit
    > >> Newsgroups: microsoft.public.inetserver.asp.general
    > >> NNTP-Posting-Host: vp161007.kln.uac1.hknet.com 203.169.161.7
    > >> Lines: 1
    > >> Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
    > >> Xref: cpmsftngxa06.phx.gbl

    microsoft.public.inetserver.asp.general:252150
    > >> X-Tomcat-NG: microsoft.public.inetserver.asp.general
    > >>
    > >> Hi all,
    > >>
    > >> Anyone know of any special issues with storing cookies with ASP? I'm
    > >> trying this with two browsers: One is IE 6.0 with cookies set to
    > >> 'prompt'. This has been working properly as any new site I goto seems
    > >> to prompt me to store their cookie. The other is Pocket IE on Pocket
    > >> PC 2002, with the cookies set to 'enabled'.
    > >>
    > >> My problem is that the cookies dont seem to be being written with my
    > >> ASP. I dont get the prompt to store the cookie when I should. My
    > >> storage code looks like this:
    > >>
    > >> Response.Cookies("AcctNbr") = nAcctNbr
    > >> Response.Cookies("MsgStart") = nMsgStart
    > >> Response.Cookies("MsgEnd") = nMsgEnd
    > >> Response.Cookies("AcctNbr").Expires = DateAdd("h", 15, Now)
    > >> Response.Cookies("MsgStart").Expires = DateAdd("h", 15, Now)
    > >> Response.Cookies("MsgEnd").Expires = DateAdd("h", 15, Now)
    > >>
    > >>
    > >> And the read code looks like this:
    > >>
    > >> If Not(Request.Cookies("AcctNbr")="") Then
    > >> nAcctNbr = CInt(Request.Cookies("AcctNbr"))
    > >> End If
    > >> If Not(Request.Cookies("MsgStart")="") Then
    > >> nMsgStart = CInt(Request.Cookies("MsgStart"))
    > >> End If
    > >> If Not(Request.Cookies("MsgEnd")="") Then
    > >> nMsgEnd = CInt(Request.Cookies("MsgEnd"))
    > >> End If
    > >>
    > >>
    > >> Of course nothing is read in, but past that, my browser does not
    > >> prompt for storage either..
    > >>
    > >> Any ideas?
    > >>
    > >> Thanks in advance...
    > >>
    > >> -BB
    > >>

    >
    >
    Mike Moore [MSFT], Sep 12, 2003
    #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. Jason

    storing`passwords in cookies

    Jason, Dec 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    471
    Cowboy \(Gregory A. Beamer\)
    Dec 29, 2003
  2. Alex Nitulescu

    Response.Cookies vs Request.Cookies

    Alex Nitulescu, Feb 3, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    8,450
    Hans Kesting
    Feb 3, 2005
  3. toton
    Replies:
    11
    Views:
    694
    toton
    Oct 13, 2006
  4. Jonathan Wood
    Replies:
    1
    Views:
    497
    Jonathan Wood
    Jun 2, 2008
  5. _Who
    Replies:
    7
    Views:
    2,625
Loading...

Share This Page