Home » Glossary Terms » What Is a Session?

What Is a Session?

A session is a temporary connection between two devices or between a user and a website that lasts for a defined period of activity. When you log in to a website, browse around, and eventually leave or get logged out, that entire interaction is considered a session. 

Sessions exist because the web’s underlying protocol, HTTP, does not inherently remember who you are between requests. To work around this, websites create sessions using tools like cookies or session tokens, which store a small identifier on your device that keeps you recognized and logged in as you move from page to page. 

Every session has a lifespan. If you stay inactive for too long, the session expires, and you may be prompted to log in again. Sessions can also end if your IP address changes mid-activity, which can happen with a dynamic IP address since your ISP may reassign addresses periodically. 

From a security standpoint, sessions are a common target for hijacking attacks, where a bad actor attempts to steal a session token and impersonate a legitimate user.