Author: ataxia1 | Posted on: 9/11/2009 3:21:20 PM | Views : 1206

In researching, I've found several posts that discuss similar issues and pose a few suggestions (some of which are ridiculously complex), but it would be nice to have a simple, definitive answer.
SCENARIO:
Session("Defined") = "Happy .net"
Response.Write Session("Defined").ToString     Results in: "Happy .net"
Response.Write Session("Not_Yet_Defined").ToString     Results in: "Object reference not set..."
What is the best way to trap and prevent this error?
Here's how I'm doing it, but it seems a bit cumbersome:
If Session("Not_Yet_Defined") Is Nothing The
    Response.Write("")
Else
    Response.Write Session("Not_Yet_Defined").ToString
End If
Suggestions?
Thanks
...

Go to the complete details ...