saving checkbox state on reload

Purely in JavaScript supporting localStorage if available, otherwise using document.cookie. function getStorage(key_prefix) { // this function will return us an object with a “set” and “get” method // using either localStorage if available, or defaulting to document.cookie if (window.localStorage) { // use localStorage: return { set: function(id, data) { localStorage.setItem(key_prefix+id, data); }, get: function(id) { … Read more

How is HttpOnly get set for ASP.NET_SessionId cookie?

ASP.NET session cookies are HTTP only, regardless of the httpOnlyCookies setting linked to in your question, because this is burned into ASP.NET. You can’t override this. If you dig into the System.Web.SessionState.SessionIDManager class in the System.Web assembly the code for creating the ASP.NET session cookie looks like: private static HttpCookie CreateSessionCookie(string id) { HttpCookie cookie … Read more

PHP Session Id changes between pages

According to PHP documentation, session_start must be called before any output is sent back to the browser– could this page have a rogue CR/LF, Unicode byte-order mark or similar that is causing output before you include(‘session-inc.php’)?

Setting a cookie in an AJAX request?

Here are few suggestions: Make sure that you are specifying the correct expiration format of date When setting a cookie on a page that redirects, the cookie must be set after the call to header(‘Location: ….’); eg: header(‘Location: http://www.example.com/’); setcookie(‘asite’, $site, time()+60*60, “https://stackoverflow.com/”, ‘site.com’); If you have human urls like www.domain.com/path1/path2/, then you must set … Read more