日期:2014-05-17  浏览次数:20551 次

webserver中使用session
 Random rnd = new Random();
            int n = rnd.Next(100000, 999999);
            try
            {
               // Session["code"] = n.ToString();
               //Session.Add("code", n.ToString());
                Session["code"] = "123123";
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                return isbool;
            }


session老报“未将对象引用设置到对象实例”?

------解决方案--------------------
[WebMethod(EnableSession = true)]
------解决方案--------------------
有调试没?是走到哪里报的这个错?