本文整理汇总了VB.NET中System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration方法的典型用法代码示例。如果您正苦于以下问题:VB.NET WebConfigurationManager.OpenWebConfiguration方法的具体用法?VB.NET WebConfigurationManager.OpenWebConfiguration怎么用?VB.NET WebConfigurationManager.OpenWebConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Configuration.WebConfigurationManager
的用法示例。
在下文中一共展示了WebConfigurationManager.OpenWebConfiguration方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: OpenWebConfiguration
' Show how to use OpenWebConfiguration(string).
' It gets he appSettings section of a Web application
' runnig on the local server.
Shared Sub OpenWebConfiguration1()
' Get the configuration object for a Web application
' running on the local server.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration("/configTest")
' Get the appSettings.
Dim appSettings As KeyValueConfigurationCollection = _
config.AppSettings.Settings
' Loop through the collection and
' display the appSettings key, value pairs.
Console.WriteLine("[appSettings for app at: {0}]", "/configTest")
Dim key As String
For Each key In appSettings.AllKeys
Console.WriteLine("Name: {0} Value: {1}", _
key, appSettings(key).Value)
Next key
Console.WriteLine()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:25,代码来源:WebConfigurationManager.OpenWebConfiguration
示例2: OpenWebConfiguration
' Show how to use OpenWebConfiguration(string, string).
' It gets he appSettings section of a Web application
' runnig on the local server.
Shared Sub OpenWebConfiguration2()
' Get the configuration object for a Web application
' running on the local server.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/configTest", "Default Web Site")
' Get the appSettings.
Dim appSettings As KeyValueConfigurationCollection = _
config.AppSettings.Settings
' Loop through the collection and
' display the appSettings key, value pairs.
Console.WriteLine("[appSettings for app at: /configTest")
Console.WriteLine(" and site: Default Web Site]")
Dim key As String
For Each key In appSettings.AllKeys
Console.WriteLine("Name: {0} Value: {1}", _
key, appSettings(key).Value)
Next key
Console.WriteLine()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:28,代码来源:WebConfigurationManager.OpenWebConfiguration
示例3: OpenWebConfiguration
' Show how to use OpenWebConfiguration(string, string, string).
' It gets he appSettings section of a Web application
' runnig on the local server.
Shared Sub OpenWebConfiguration3()
' Get the configuration object for a Web application
' running on the local server.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/configTest", "Default Web Site", Nothing)
' Get the appSettings.
Dim appSettings As KeyValueConfigurationCollection = _
config.AppSettings.Settings
' Loop through the collection and
' display the appSettings key, value pairs.
Console.WriteLine("[appSettings for app at: /configTest")
Console.WriteLine(" site: Default Web Site")
Console.WriteLine(" and locationSubPath: null]")
Dim key As String
For Each key In appSettings.AllKeys
Console.WriteLine("Name: {0} Value: {1}", _
key, appSettings(key).Value)
Next key
Console.WriteLine()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:28,代码来源:WebConfigurationManager.OpenWebConfiguration
示例4: OpenWebConfiguration
' Show how to use OpenWebConfiguration(string, string,
' string, string).
' It gets he appSettings section of a Web application
' running on the specified server.
' If the server is remote your application must have the
' required access rights to the configuration file.
Shared Sub OpenWebConfiguration4()
' Get the configuration object for a Web application
' running on the specified server.
' Null for the subPath signifies no subdir.
Dim config As System.Configuration.Configuration = WebConfigurationManager.OpenWebConfiguration("/configTest", "Default Web Site", Nothing, "myServer")
' Get the appSettings.
Dim appSettings As KeyValueConfigurationCollection = config.AppSettings.Settings
' Loop through the collection and
' display the appSettings key, value pairs.
Console.WriteLine("[appSettings for Web app on server: myServer]")
Dim key As String
For Each key In appSettings.AllKeys
Console.WriteLine("Name: {0} Value: {1}", key, appSettings(key).Value)
Next key
Console.WriteLine()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:26,代码来源:WebConfigurationManager.OpenWebConfiguration
示例5: OpenWebConfiguration
' Show how to use OpenWebConfiguration(string, string,
' string, string, IntPtr).
' It gets he appSettings section of a Web application
' running on a remote server.
' If the serve is remote your application shall have the
' requires access rights to the configuration file.
Shared Sub OpenWebConfiguration6()
Dim userToken As IntPtr = _
System.Security.Principal.WindowsIdentity.GetCurrent().Token
Dim user As String = _
System.Security.Principal.WindowsIdentity.GetCurrent().Name
' Get the configuration object for a Web application
' running on a remote server.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/configTest", "Default Web Site", _
Nothing, "myServer", userToken)
' Get the appSettings.
Dim appSettings As KeyValueConfigurationCollection = _
config.AppSettings.Settings
' Loop through the collection and
' display the appSettings key, value pairs.
Console.WriteLine( _
"[appSettings for Web app on server: myServer user: {0}]", user)
Dim key As String
For Each key In appSettings.AllKeys
Console.WriteLine("Name: {0} Value: {1}", _
key, appSettings(key).Value)
Next key
Console.WriteLine()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:37,代码来源:WebConfigurationManager.OpenWebConfiguration
示例6: OpenWebConfiguration
' Show how to use OpenWebConfiguration(string, string,
' string, string, string, string).
' It gets he appSettings section of a Web application
' running on a remote server.
' If the server is remote your application must have the
' required access rights to the configuration file.
Shared Sub OpenWebConfiguration5()
' Get the current user.
Dim user As String = _
System.Security.Principal.WindowsIdentity.GetCurrent().Name
' Assign the actual password.
Dim password As String = "userPassword"
' Get the configuration object for a Web application
' running on a remote server.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/configTest", "Default Web Site", _
Nothing, "myServer", user, password)
' Get the appSettings.
Dim appSettings As KeyValueConfigurationCollection = _
config.AppSettings.Settings
' Loop through the collection and
' display the appSettings key, value pairs.
Console.WriteLine( _
"[appSettings for Web app on server: myServer user: {0}]", user)
Dim key As String
For Each key In appSettings.AllKeys
Console.WriteLine("Name: {0} Value: {1}", _
key, appSettings(key).Value)
Next key
Console.WriteLine()
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:38,代码来源:WebConfigurationManager.OpenWebConfiguration