Results 1 to 3 of 3

Thread: Cookie not saving

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2009
    Location
    Milan
    Posts
    810

    Cookie not saving

    Is this right way to save a cookie across several pages in one web folder?

    It does not seem to be working

    Code:
    Response.Cookies("LoggedIn").Value = 1
    Response.Cookies("LoggedIn").Expires = Now.Date.AddHours(1)
    what is wrong?

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Cookie not saving

    Hello,

    As per the documentation here:

    http://msdn.microsoft.com/en-us/libr...kies101anchor5

    Specifically the "Writing Cookies" section, what you are doing "should". Do you have cookies enabled on your browser?

    Gary

  3. #3
    Frenzied Member avrail's Avatar
    Join Date
    Mar 2006
    Location
    Egypt, Cairo
    Posts
    1,221

    Re: Cookie not saving

    hay,
    as Gary asked you, you have to check if the cookies enabled into your browser

    Code:
    if(Request.Browser.Cookies)
    {
    /// this means it is enabled and supported in your browser
    }
    else{
    /// means not supported 
    }
    your codes didn't add any cookies yet
    Code:
    // to add your cookie 
    Response.Cookies.Add("LoggedIn");
    You Don't Have to Rate Me.
    I'm Not a Civilized Man I'm the Civilization it self
    White or Black, Living or Dieing and 0 or 1 that's MY life
    iam an Object in Object Oriented Life
    my blog : http://refateid.blogspot.com/
    twitter :@avrail
    010011000111010101110110001000000100110101111001001000000101000001100011

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