Professional Documents
Culture Documents
WEB ENGINEERING
WHAT IS A SESSION?
• A session starts when a user accesses a web application and ends when the
user closes the browser, logs out, or after a period of inactivity (timeout).
• During a session, the server and client (usually a web browser) exchange
information to maintain the state of the user's interactions.
HOW SESSIONS WORK:
• When a user first accesses a web application, the server generates a unique session
identifier (usually a session ID).
• This session ID is typically stored as a cookie on the client side or passed in URLs.
• With each subsequent request, the client sends this session ID to the server, allowing the
server to identify the user and retrieve their session data.
• Session data can include information such as user preferences, shopping cart contents,
authentication tokens, etc.
• The server stores this session data either in memory, on disk, or in a database.
SESSION MANAGEMENT:
• HTTP is termed as stateless because each request from a client to the server is
independent and unrelated to previous or future requests.
• The server does not retain any information about the state of the client between requests.
• Once a response is sent back to the client, the server forgets everything about the request.
COOKIES
• Cookies are small pieces of data stored on a user's device by their web browser while
they are browsing a website.
• They play a fundamental role in enabling various functionalities on the web, ranging
from session management to personalization and tracking.
PURPOSE OF COOKIES:
• Session Management: Cookies are commonly used to manage user sessions. They help
in identifying users and maintaining their state across multiple page views or visits to a
website.
• Personalization: Websites use cookies to remember user preferences and settings, such
as language preferences, layout preferences, or items in a shopping cart.
• Tracking and Analytics: Cookies are often employed by website owners and third-party
services for tracking user behavior, measuring website performance, and delivering
targeted advertisements.
• Security: Cookies can also enhance website security by validating user identities,
preventing unauthorized access, and detecting suspicious activities.
TYPES OF COOKIES:
• Session Cookies: These cookies are temporary and are deleted once the user closes the browser.
They are typically used for session management purposes.
• Persistent Cookies: Persistent cookies remain on the user's device for a specified duration or
until manually deleted by the user. They are often used for long-term tracking, personalization,
and authentication.
• First-Party Cookies: First-party cookies are set by the website domain that the user is visiting.
They are primarily used for purposes such as session management and personalization.
• Third-Party Cookies: Third-party cookies are set by domains other than the one the user is
currently visiting. They are commonly used for tracking user behavior across different websites,
often for advertising and analytics purposes.
COOKIE ATTRIBUTES: