Session.Clear();Totally remove the Session:
Session.Abandon();Clean Cache:
HttpRuntime.Close();Note: Be careful when using this way to clear the cache (See here). I found a better way to do the same thing from here.
ListcacheKeys = new List ();
IDictionaryEnumerator cacheEnum = Cache.GetEnumerator();
while (cacheEnum.MoveNext())
{
cacheKeys.Add(cacheEnum.Key.ToString());
}
foreach (string cacheKey in cacheKeys)
{
Cache.Remove(cacheKey);
}
Reference: What is the best way to end session?
No comments:
Post a Comment