Session hijacking can occur, although there are a number of methods. HTTPS prevents sniffing, but XSS is the most common attack. You can use httponlycookies to prevent an xss attack from accessing document.cookie , but then an attacker can simply “drive through” the xmlhttprequest session (Sammy did it on MySpace). Speaking of riding, you should learn CSRF . Even SQL Injection can be used to capture a session if you store the session identifier in the database, but not all web applications do this.
Use httponlycookies, make sure they are only https, use https for everything. Do not use asp.net sessions without a pedestrian without use , this makes you vulnerable to Session Fixation . Session ID must always be transmitted using a cookie and never transmitted as GET or POST. You can consider using STS .
source share