[VB]请问“未将对象引用设置到对象的实例”是什么样的错误?
我按照书的测试一下如何读取config.web中的内容,但出错。
config.web中的内容
++++++++++++++++++++++++++++++
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
<configsections>
<add name="test" type="System.Web.Configuration.DictionarySectionHandler" />
</configsections>
<test>
<add key="key" value="just a configure test" />
</test>
</configuration>
+++++++++++++++++++++++++++
读取页面的内容
+++++++++++++++++++++++++
<%@ Page Language="vb" Debug="true" %>
<script runat="server">
sub page_load(s as object ,e as eventargs)
Dim CfgSection As Hashtable = Context.GetConfig("test")
Dim Msg As String = cstr(CfgSection("key"))
response.write(Msg )
end sub
</script>
++++++++++++++++++++++++
提示错误: System.NullReferenceException: 未将对象引用设置到对象的实例。
指向:Dim Msg As String = cstr(CfgSection("key"))
求教了!!