Friday, February 22, 2008

Clearing Session Variables

Session.Abandon and Session.Clear() is the two methods that gave me a HUGE headache for the day.

Logout isnt working as i wanted. Only after a postback, its clearing the controls.

What to do, I Donno.. If i get the solution, ill try to add it here.

This was the Code That i was using in the LOG OUT Page LOAD

Session.Abandon()
Response.Cache.SetCacheability(HttpCacheability.No Cache)
Response.Cache.SetExpires(Now().AddSeconds(-1))
Response.Cache.SetNoStore()
Response.AddHeader("Pragma", "no-cache")

This also didnt help much. Later i Added this particular line in all the ASPX pages.

<%@ OutputCache Location = "none" %>

FINALLY IT WORKED. NOW ITS FINE, BUT STILL UNSURE, WHY IT WAS NOT WORKING.

THIS IS ONE OF THE SIMPLEST REASON, WHY WEB DEVELOPMENT IS "NOT SO EASY"

0 comments: