c# - Cookie expiry date not set -


here get:

protected string identifier {         {         httpcookie cookie = request.cookies[identifier_cookie];          if (cookie != null)         {             return cookie.value;         }         else         {             cookie = new httpcookie(identifier_cookie);             cookie.value = guid.newguid().tostring();             cookie.expires = datetime.now.addyears(1);             response.cookies.add(cookie);              return cookie.value;         }     } } 

when running project locally, cookie's expiry date set expected

local

but when run live, cookie's expiry date when browsing session ends.

live

what doing wrong?

before doing else, suggest clear cache , cookies.

protected string identifier {         {         httpcookie cookie = request.cookies[identifier_cookie];          if (!cookie)         {             cookie = new httpcookie(identifier_cookie);             cookie.value = guid.newguid().tostring();         }cookie.expires = datetime.now.addyears(1);         response.cookies.set(cookie);          return cookie.value     } } 

Comments