code for browser to accept all cookies for website RRS feed

  • Question

  • User295590651 posted


    I am using lot of session variables in my website, some of the session variables does not work in redirect in IE because the browser is not set to accept all cookies for the website.

    How can i make client browser to accept all cookies for my website.

    Please advise.


    Thursday, July 16, 2015 4:43 PM


All replies

  • User409696431 posted

    You cannot force the client's browser to do anything is isn't set to do.  IE *and other browsers* have a limit on how many cookies, the max size of each cookie, and for some, the total size of all those cookies, that will be accepted from one domain before they no longer accept a new cookie.

    See this link for tests and results on this: http://browsercookielimits.squawky.net/

    Your option is:  Don't exceed the limits.  Use a different method to store your variables.

    Thursday, July 16, 2015 5:16 PM
  • User461988170 posted

    Hi sagrawal0008,

    According your description, the session variables does not work in redirect in IE. Actually IE does a lot of client side caching, and would not retrieve a page which is in the current cache. You can add these lines to your page load event:

    Response.ExpiresAbsolute = DateTime.Now.AddMonths(-1);

    Best Regards,

    Candy Zhou

    Friday, July 17, 2015 3:00 AM
  • User541108374 posted


    besides the options provided here by others you might also want to take a look into cookiess session state (https://msdn.microsoft.com/en-us/library/aa479314.aspx#cookieless_topic2). Basically it adds another string in your querystring that can be identified by ASP.NET to track down the session for that user.

    Grz, Kris.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 17, 2015 3:06 AM
  • User753101303 posted


    Though a cookie is needed to identify the session itself, other than that session variables and cookies are unrelated. I would search in another direction (and to start with would check if I keep using the same session).

    Try perhaps http://weblogs.asp.net/bleroy/Don_2700_t-redirect-after-setting-a-Session-variable-_2800_or-do-it-right_2900_

    Friday, July 24, 2015 4:10 AM