.net自定义类中Session 存值说
未将对象引用设置到对象的实例 public int intUserID
{
set
{
if (value != null)
{
int intUserID;
if (int.TryParse(value.ToString(), out intUserID))
{
HttpContext.Current.Session["UserID"] = intUserID;
}
}
}
get
{
if (HttpContext.Current.Session["UserID"] == null)
{
return -1;
}
else
{
try
{
return Convert.ToInt32(HttpContext.Current.Session["UserID"].ToString());
}
catch (Exception)
{
return -1;
}
}
&