日期:2014-05-18  浏览次数:20518 次

Message="未将对象引用设置到对象的实例。"
这句出错:
String test = Application["test"].ToString();

出错信息如下:
用户代码未处理 System.NullReferenceException
? Message="未将对象引用设置到对象的实例。"
? Source="App_Web_hjqkcgyq"
? StackTrace:
? 在 TestList.Button2_Click(Object sender, EventArgs e) 位置 k:\WebSite4\WebSite4\a\TopicList.aspx.cs:行号 61
? 在 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
? 在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
? 在 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
? 在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
? 在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
? 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
? InnerException:?


------解决方案--------------------
Application["test"]是全局变量啊,每个用户看到的都是一样的,不能使用Application变量保存那样的信息
------解决方案--------------------
1、对的,是这样的
2、不会