Cookie
An HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.
ASP.NET Core in Action, 3e
An authentication cookie is a client-side HTTP cookie containing serialized authentication state used to recognize a signed-in user across requests.
- How it is used
- Maintains a signed-in user’s identity across requests to a traditional web app.
- How deep it goes
- Traces credential validation, principal serialization, and subsequent request authentication, then discusses security settings and multi-app limitations.
- Examples
- Uses a sign-in form and a banking transfer attacked through a malicious form.
- What you can do after
- Evaluate/understand how cookie authentication restores a user and why automatically sent cookies need CSRF protection.
The Well-Grounded Python Developer: How the pros use Python and Flask
A cookie is client-side data exchanged with a web server on subsequent requests to retain information or identify a client.
- How it is used
- Connects successive HTTP requests to a session so a blog can remember users and restrict posting or commenting.
- How deep it goes
- Works through creation, signing, request reuse, lifetime, login, and logout; defers detailed database treatment.
- Examples
- Uses a blog login flow, a user record, restricted posts and comments, and a logout route.
- What you can do after
- Apply it via Flask and Flask-Login to remember authenticated users across requests and log them out.
Read how The Well-Grounded Python Developer: How the pros use Python and Flask explains cookie →
Grokking Web Application Security
A cookie is a small piece of text that a web server directs a browser to store and send with subsequent requests to the applicable domain.
- How it is used
- Maintains authenticated browser sessions across stateless HTTP requests.
- How deep it goes
- Explains cookie request flow and security attributes, including expiry and logout invalidation.
- Examples
- Uses Set-Cookie and Cookie headers, a session identifier, and logout via Max-Age=-1.
- What you can do after
- Operate/configure session cookies with transport, script-access, cross-site, lifetime, and logout protections.
Read how Grokking Web Application Security explains cookie →
Building Web APIs with ASP.NET Core
Session-cookie authentication stores authentication state on a server-side session and sends a session identifier to the client in a cookie.
- How it is used
- Maintains authentication state across otherwise independent HTTP requests and supports authorization checks.
- How deep it goes
- Explains the storage, identifier, cookie, and retrieval flow without detailing framework-specific configuration.
- Examples
- Uses a login result, a stored user identity, a generated sessionId, and repeated browser requests.
- What you can do after
- Evaluate how a server preserves login state and identifies users on subsequent requests.
Read how Building Web APIs with ASP.NET Core explains cookie →
Pro ASP.NET Core 7, Tenth Edition
A cookie is a small piece of data that a web server stores in a client and receives with subsequent requests to maintain state or preferences.
- How it is used
- Carries values into later requests to support counters and authenticated access.
- How deep it goes
- Works through reading, appending, configuring, deleting, and inspecting cookies, then applies them to authentication; does not examine browser storage internals.
- Examples
- Uses a thirty-minute visit counter, a cookie-inspection Razor Page, and a JavaScript client that logs in before requesting protected data.
- What you can do after
- Build it from scratch with ASP.NET Core request and response cookie APIs, then inspect cookie-based sign-in and logout behavior.
Read how Pro ASP.NET Core 7, Tenth Edition explains cookie →
Coding with AI
A cookie is a small piece of data that a web browser stores and sends with requests to preserve client-specific state.
- How it is used
- Preserves a user's database-backed web session across page requests and refreshes.
- How deep it goes
- Explains reading, creating, setting, and deleting a session cookie, while stopping short of broader cookie security considerations.
- Examples
- Uses a Flask practice-test page, a session_id cookie, response.set_cookie, refresh persistence, and a delete-and-refresh button.
- What you can do after
- Operate/configure a Flask route that persists, reuses, and clears a database-backed session through a browser cookie.
React in Depth
A web cookie is a small piece of data that a website stores in a browser and can send with subsequent requests to a server.
- How it is used
- Persists small display and location preferences that server-rendered React pages must know before hydration.
- How deep it goes
- Explains request transmission, capacity trade-offs, hydration failure, and framework APIs, stopping short of broader cookie security policy.
- Examples
- Uses weather-scale, time-format, and local-city preferences, with Next.js and Remix route implementations.
- What you can do after
- Apply it via cookies-next or Remix cookie utilities to synchronize small preferences between requests, server rendering, and clients.
WordPress Power Toolkit: Harness AI to build next-level websites
A cookie is a small text file that a website stores on a user's device to retain information, track activity, personalize experiences, or support data collection.
- How it is used
- Supports remembered actions, administrator access, tracking, personalization, advertising, and website data collection.
- How deep it goes
- Defines cookies and shows practical uses, consent concerns, and plugin options without detailing browser-level implementation.
- Examples
- Uses remembered forms and logins, administrator access to a hidden site, and WordPress cookie-consent plugins.
- What you can do after
- Operate WordPress cookie features and choose consent measures for sites that store visitor cookies.
Read how WordPress Power Toolkit: Harness AI to build next-level websites explains cookie →
First-Party Data Activation
A first-party cookie is a web cookie created and controlled by the site owner for recognizing users or sessions within that owner's own interactions and infrastructure.
- How it is used
- Connects anonymous website activity to acquisition marketing and later account interactions.
- How deep it goes
- Defines cookies by domain ownership and describes session continuity and account linking, without detailing implementation.
- Examples
- Uses shopping-cart continuity and an airline flight choice connected to an account after sign-in.
- What you can do after
- Understand how first-party cookies preserve session context and connect prelogin activity to a signed-in account.
Hidden Influences
A small data file stored by a web browser to preserve website-related state or record activity.
- How it is used
- Preserves website state and enables cross-website browsing tracking for advertising.
- How deep it goes
- Defines cookies and illustrates first-party and third-party tracking, but notes that newer technologies handle some classic uses differently.
- Examples
- Uses shopping carts, remembered logins, outdoor-gear browsing, hotel searches, and related social-media ads.
- What you can do after
- Evaluate how remembered state and cross-site browsing data can shape targeted advertising.
Real-World Cryptography
A cookie is a small piece of data stored by a web browser and sent with subsequent requests to a website.
- How it is used
- Maintains user authentication across multiple web requests without repeatedly sending credentials.
- How deep it goes
- Explains browser storage, session identifiers, scaling tradeoffs, tampering, and MAC-based protection.
- Examples
- Uses login credentials, random session strings, editable usernames, and authentication tags as concrete examples.
- What you can do after
- Apply browser cookies for persistent sessions and recognize why unauthenticated cookie contents enable impersonation.
Also covered in
- Software Testing with Generative AI
- Go in Practice, Second Edition
- AI-Powered Search
- Quarkus in Action
- Hacking Cryptography
- Authorization in Action
- Writing for Developers: Blogs that get read
- Vanilla WebIn early access (MEAP)
What to know first
- HTTPHTTP is an application-layer protocol that defines request-and-response communication for transferring resource representations and related metadata between networked systems.
- authenticationAuthentication is the process of verifying the claimed identity of a user, service, device, or other entity.
- HTTP requestAn HTTP request is a message sent by a client to a server using the Hypertext Transfer Protocol, specifying a method and target and optionally including headers and a body.
- JavaScriptJavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
Related concepts
- JSON Web Tokenalternative to · A JSON Web Token is a compact, URL-safe format for representing claims as a JSON object that can be digitally signed, integrity-protected, or encrypted.
- web storage apialternative to · The Web Storage API is a browser API for storing string key-value data on the client side in origin-associated storage areas such as localStorage and sessionStorage.
- bearer authenticationalternative to · Bearer authentication is an authentication scheme in which presenting a bearer token is sufficient to use the access or authorization granted by that token.
- browserused by · A web browser is software that retrieves, interprets, and renders web resources, executes supported web content, and enables interaction with web applications.
- HTTPSaddressed by · HTTPS is HTTP carried over TLS to provide encrypted communication and authentication between network endpoints.
- local storagealternative to · Local storage is a browser-provided, origin-scoped key-value storage mechanism for string data that persists across sessions.
Questions about cookie
What is cookie?
An HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.
Which Manning books explain cookie?
ASP.NET Core in Action, 3e, The Well-Grounded Python Developer: How the pros use Python and Flask, Grokking Web Application Security, Building Web APIs with ASP.NET Core, Pro ASP.NET Core 7, Tenth Edition, Coding with AI, React in Depth, WordPress Power Toolkit: Harness AI to build next-level websites and 3 more.
What should I know before learning cookie?
Manning books that teach cookie usually introduce HTTP, authentication, HTTP request and JavaScript first.
What is the difference between cookie and JSON Web Token?
An HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences. A JSON Web Token is a compact, URL-safe format for representing claims as a JSON object that can be digitally signed, integrity-protected, or encrypted.
What is cookie also called?
Cookie is also called cookies.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.










