客户反映出现 object reference not set to an instance of an boject
我怀疑是的问题 session
我们网站有不少客户,这个问题偶尔会出现,大概1000个人有一个人会有这个问题吧,
是什么问题啊,
下面是cookiele和Session 的取值
public static int EnterpriseID()
{
HttpContext context = HttpContext.Current ;
HttpCookie cookie=context.Request.Cookies["CookieLe"];
if(cookie.Values["enterpriseID"]==null||cookie.Values["enterpriseID"]=="")
{
//return 0;
}
else
{
return int.Parse(jiemi_Des(cookie.Values["enterpriseID"]));
}
if (context.Session["enterpriseID"] == null || context.Session["enterpriseID"].ToString() == "")
{
//return 0;
}
else
{
return int.Parse(context.Session["enterpriseID"].ToString());
}
return 0;
}
就是这里偶尔会出错的。
public static bool EnterpriseAuthenticated()
{
HttpContext context = HttpContext.Current ;
if (context.Session["enterpriseID"] == null || context.Session["enterpriseID"].ToString() == "")
{
//return(false);
}
else
{
return (true);
}
if (context.Request.Cookies["CookieLe"] == null)
return false;
HttpCookie cookie=context.Request.Cookies["CookieLe"];
//string name=cookie.Values["name"];
//string age=cookie.Values["age"];
if(cookie.Values["enterpriseID"]==null||cookie.Values["enterpriseID"]=="")
{
}
else
{
int intmy = IsNumeric(cookie.Values["enterpriseID"]);
if (intmy > 0)
return false;
else