我要检查该会话为空或空即有些事情是这样的:检查会话是否为空或不
if(Session["emp_num"] != null)
{
if (!string.IsNullOrEmpty(Session["emp_num"].ToString()))
{
//The code
}
}
或者只是
if(Session["emp_num"] != null)
{
// The code
}
因为有时当我只检查与:
if (!string.IsNullOrEmpty(Session["emp_num"].ToString()))
{
//The code
}
我面对以下荷兰国际集团的例外:
空引用例外
看看这个帖子 http://stackoverflow.com/questions/234973/what-is-the-best-way-to-determine-a-session-variable-is-null -or-empty-in-c – Bobby
非常好,非常感谢。 –