IE does not accept session cookies

Discussion in 'ASP .Net' started by StanB, Nov 14, 2007.

  1. StanB

    StanB Guest

    I came across this weird problem:

    1. Session state stops working after the app is deployed to another server
    because
    IE does not accept cookies.

    2. It works if cookieless="true" in the web.config

    3. Yes, I tried IE - Tools - Privacy - Accept All Cookies and also
    Override automatic cookie handling, Always allow session cookes

    I don't know what else it might be - IE simply does not accept the cookies
    from that server
    regardles of all settings.

    It may have somethings to do with the server being in the different AD
    domain..

    Has anyboy seen this problem?

    Thanks,

    -Stan
     
    StanB, Nov 14, 2007
    #1
    1. Advertising

  2. Well, IE certainly does accept Session cookies and all other cookies. Unless
    you can post some sample code, we'll just have to guess. Maybe you aren't
    setting the domain and / or path properties of the cookies?

    --Peter
    http://www.eggheadcafe.com
    unBlog: http://petesbloggerama.blogspot.com
    BlogMetaFinder: http://www.blogmetafinder.com



    "StanB" wrote:

    > I came across this weird problem:
    >
    > 1. Session state stops working after the app is deployed to another server
    > because
    > IE does not accept cookies.
    >
    > 2. It works if cookieless="true" in the web.config
    >
    > 3. Yes, I tried IE - Tools - Privacy - Accept All Cookies and also
    > Override automatic cookie handling, Always allow session cookes
    >
    > I don't know what else it might be - IE simply does not accept the cookies
    > from that server
    > regardles of all settings.
    >
    > It may have somethings to do with the server being in the different AD
    > domain..
    >
    > Has anyboy seen this problem?
    >
    > Thanks,
    >
    > -Stan
    >
    >
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Nov 15, 2007
    #2
    1. Advertising

  3. StanB

    StanB Guest

    I am not setting the cookies, I am setting session which may or may not use
    the cookies.
    Session state by default requires ASP_SessionState cookie but can also be
    cookieless
    in which case sesssion id is apended to url.

    There is not whole lot of code to post:
    =====
    protected void btnSetSession_Click(object sender, EventArgs e)

    {

    Session[Key] = "123";

    }



    protected void btnGetSession_Click(object sender, EventArgs e)

    {

    if (Session[Key] != null)

    {

    lblValue.Text = string.Format("Value:'{0}' Mode:'{1}'
    SessionId:'{2}'" +

    " CookieMode:'{3}' IsCookieless:{4}",

    Session[Key].ToString(),

    Session.Contents.Mode,

    Session.Contents.SessionID,

    Session.CookieMode,

    Session.Contents.IsCookieless);

    }

    else

    lblValue.Text = string.Format("Session[\"{0}\"] is null!", Key);

    }

    =====================

    The code works on my machine, but when deployed to another machine which
    belongs to a different AD domain, stops working unless the session mode is
    changed to cookieless in web.config.

    Here is the problem:

    When running on another machine somehow ASP.NET determines the IE does not
    support cookies and does even send the session cookie to the browser, I
    checked it with Fidler.

    I have no idea why ASP.NET decides that IE does not support cookies even
    after I explicitly allow all cookies in IE settings.

    I have seen people experiencing this issue and yet the only workaround is to
    change session state to be cookieless. While it is a solution, I am trying
    to get to the bottom of the problem and also in some scenarios you may not
    want to run cookieless session state.



    "Peter Bromberg [C# MVP]" <> wrote in message
    news:...
    > Well, IE certainly does accept Session cookies and all other cookies.
    > Unless
    > you can post some sample code, we'll just have to guess. Maybe you aren't
    > setting the domain and / or path properties of the cookies?
    >
    > --Peter
    > http://www.eggheadcafe.com
    > unBlog: http://petesbloggerama.blogspot.com
    > BlogMetaFinder: http://www.blogmetafinder.com
    >
    >
    >
    > "StanB" wrote:
    >
    >> I came across this weird problem:
    >>
    >> 1. Session state stops working after the app is deployed to another
    >> server
    >> because
    >> IE does not accept cookies.
    >>
    >> 2. It works if cookieless="true" in the web.config
    >>
    >> 3. Yes, I tried IE - Tools - Privacy - Accept All Cookies and also
    >> Override automatic cookie handling, Always allow session cookes
    >>
    >> I don't know what else it might be - IE simply does not accept the
    >> cookies
    >> from that server
    >> regardles of all settings.
    >>
    >> It may have somethings to do with the server being in the different AD
    >> domain..
    >>
    >> Has anyboy seen this problem?
    >>
    >> Thanks,
    >>
    >> -Stan
    >>
    >>
    >>
    >>
     
    StanB, Nov 15, 2007
    #3
    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. Robert V. Hanson
    Replies:
    2
    Views:
    671
    Yan-Hong Huang[MSFT]
    Jul 3, 2003
  2. rk325
    Replies:
    2
    Views:
    464
    rk325
    Apr 28, 2005
  3. Andy Fish
    Replies:
    3
    Views:
    6,541
    Fredrik Lindner
    Nov 6, 2003
  4. _Who
    Replies:
    7
    Views:
    2,686
  5. rk325
    Replies:
    2
    Views:
    150
    rk325
    Apr 28, 2005
Loading...

Share This Page