首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

Message="未将对象引用设置到对象的实例。"该怎么解决

2012-04-24 
Message未将对象引用设置到对象的实例。这句出错:String test Application[test].ToString()出错信

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、不会

热点排行