Test cookie

Discussion in 'ASP .Net' started by Jon Cosby, Dec 20, 2003.

  1. Jon Cosby

    Jon Cosby Guest

    I'm trying to test browsers for cookies. I have my browser set to prompt me
    to accept cookies. As it is right now, I'm getting through whether I block
    the cookie or not (no redirect). I'm deleting the files from my cookies each
    time. Maybe it's just not as simple as it seems, can somebody suggest
    something?

    Response.Cookies("TestCookie").Value = "test"
    Response.Cookies("TestCookie").Expires = DateTime.Now.AddMinutes(1)
    If Request.Cookies("TestCookie") Is Nothing Then
    Response.Redirect("nocookie.aspx")
    Else
    If Not IsPostBack Then
    (Do something)


    --

    Jon Cosby

    Please do not reply to this email address.
    Jon Cosby, Dec 20, 2003
    #1
    1. Advertising

  2. Jon Cosby

    vMike Guest

    Here are my experiences with cookies...
    I believe that when you append a cookie, you can only test for it from
    another page or from a complete reload of the page that is not a postback. I
    also believe that if you are doing this from a localhost the cookie setting
    is ignored. I am not positive of this though. One other thing, if you delete
    the cookie you must close the browser before retrying your test. As I think
    the cookies are still in memory.

    "Jon Cosby" <> wrote in message
    news:cD_Eb.12131$...
    > I'm trying to test browsers for cookies. I have my browser set to prompt

    me
    > to accept cookies. As it is right now, I'm getting through whether I block
    > the cookie or not (no redirect). I'm deleting the files from my cookies

    each
    > time. Maybe it's just not as simple as it seems, can somebody suggest
    > something?
    >
    > Response.Cookies("TestCookie").Value = "test"
    > Response.Cookies("TestCookie").Expires = DateTime.Now.AddMinutes(1)
    > If Request.Cookies("TestCookie") Is Nothing Then
    > Response.Redirect("nocookie.aspx")
    > Else
    > If Not IsPostBack Then
    > (Do something)
    >
    >
    > --
    >
    > Jon Cosby
    >
    > Please do not reply to this email address.
    >
    >
    vMike, Dec 20, 2003
    #2
    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. Ben
    Replies:
    3
    Views:
    5,796
    Steven Cheng[MSFT]
    Jun 3, 2004
  2. Shapper

    Cookie and Session Cookie Questions.

    Shapper, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    553
  3. =?Utf-8?B?UGF1bA==?=

    Cookie Question (IP as domain and cookie file location)

    =?Utf-8?B?UGF1bA==?=, Jan 10, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,463
    Bruce Barker
    Jan 10, 2006
  4. ad
    Replies:
    2
    Views:
    7,465
    Kevin Spencer
    Jan 27, 2006
  5. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    683
    Skybuck Flying
    Oct 4, 2009
Loading...

Share This Page