获取XML节点内容的问题?
请问如何能获取appSettings的整个节点的内容?
Dim configPath As String = Server.MapPath("web.config")
Dim doc As XmlDocument = New XmlDocument()
doc.PreserveWhitespace = True
doc.Load(configPath)
Dim appSettingsXmlNode As XmlNode
appSettingsXmlNode = doc.DocumentElement.SelectSingleNode("//appSettings")
AppSettingsEncrypted.Text = Chr(13) & Chr(10) & appSettingsXmlNode.OuterXml
'这句提示"未将对象引用到实例"
Web.config内容如下:
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="currencyService" value="http://www.microsoft.com/services/currencyService.asmx"/>
<add key="creditCardValidationService" value="http://www.microsoft.com/services/cc.asmx"/>
</appSettings>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm"/>
<error statusCode="404" redirect="FileNotFound.htm"/>
</customErrors>
-->
</system.web>
</configuration>