Hi there,
Good to hear you like the book.
I think you're mixing up two concepts here: Caching and Sessions. The problem you're describing is not related to sessions, but to caching. The previous page is cached by the browser so it's shown without another request to the server. To fix this, add the following line to the page you want to expire:
Code:
Response.Cache.SetCacheability(HttpCacheability.NoCache)
This tells the browser not to cache the page, and to request it from the server again instead.
You may have to clear your browser's cache the first time to make this work.
If it still doesn't work, try a combination of the following:
Code:
Response.Expires = -1500
Response.AddHeader("Pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
Response.Cache.SetExpires(DateTime.Now.Date.AddDays(-100))
Response.Cache.SetNoServerCaching()
Response.ExpiresAbsolute = DateTime.Now.AddDays(-100)
Response.Cache.SetNoStore()
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetValidUntilExpires(False)
You probably don't need them, but I've seen people report success with various combinations of these cache settings. YMMV.
Hope this helps,
Cheers,
Imar