A session stores the variables and their values within a file in a temporary directory on the server. Cookies are stored on the user’s computer as a text file . The session ends when the user logout from the application or closes his web browser. Cookies end on the lifetime set by the user.