Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes.
I have seen this so many times that people are making wrong use of Session variables. Storing live information into Session variables is not a good idea. Suppose that if I am running a website that displays stock information. I would never place stock information into a session variable since it has to be updated every now and then. Storing the information might save us trip to the database but it will always display outdated information to the user. The following code sample will always return stale information to the user.
 
get
			{

				
				if( Session[DS_Stock_Information] == null)
				{
					Session[DS_Stock_Information] = GetStockInformation();
				}
				return Session[DS_Stock_Information] as DataSet;
			}

			set
			{
				Session[DS_Stock_Information] = value;
			}
		}
Posted on Wednesday, June 22, 2005 11:20 AM | Back to top


Comments on this post: Making wrong use of Session Variables

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Mohammad Azam | Powered by: GeeksWithBlogs.net