我想获取app.config
文件的路径,但无法获取它。这是我一直在尝试的方法:
Public Shared Function GetConfiguration(Optional ByVal fileName As String = "")
Dim map As System.Configuration.ExeConfigurationFileMap = New ExeConfigurationFileMap()
'read file from given path
Dim objApplicationIdentity As New ApplicationIdentity("")
If Not String.IsNullOrEmpty(fileName) Then
map.ExeConfigFilename = "~" & fileName ' the root web.config
Else
map.ExeConfigFilename = "..\\app.config" ' the root web.config
End If
''read cogfiguration settings
strConfig = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None)
End Function
我如何获得路径?