How to test Session[] exists/!exists without error

Nov 7 2005 3:19 PM
in a web app:

if (Session["id"].ToString() == ""){}


compiles ok but at run time generates:

[NullReferenceException: Object reference not set to an instance of an object.]
   cart.cart.Page_Load(Object sender, EventArgs e) in c:\documents and settings\ron robinson\vswebcache\bubba.cartsppt.com\index.aspx.cs:61

Any ideas on how to avoid this?

Ron Robinson
[email protected]