0

This snippet will allow you to easily work with session variables in your applications. This example is using a string type but it works the same for any data type, you would just need to change the default return value from string.Empty to something more appropriate.

public string PropertyName
{
	get
	{
		object temp = Session["PropertyName"];
		// Returns an empty string if the session variable is null
		// otherwise it casts the session variable to a string and returns it
		return temp == null ? string.Empty : temp as string;
	}
	set
	{
		Session["PropertyName"] = value;
	}
}
2
Contributors
1
Reply
15
Views
5 Years
Discussion Span
Last Post by LastMitch
0

Sometimes an image would be nice or echoing out the session letting people know is working or not.

Maybe included this:

<% Response.Write Session.CodePage(=PropertyName) %>

I don't know you can corrected my Response.Write function.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.