本文整理汇总了VB.NET中System.Web.Configuration.WebConfigurationManager.OpenMachineConfiguration方法的典型用法代码示例。如果您正苦于以下问题:VB.NET WebConfigurationManager.OpenMachineConfiguration方法的具体用法?VB.NET WebConfigurationManager.OpenMachineConfiguration怎么用?VB.NET WebConfigurationManager.OpenMachineConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Configuration.WebConfigurationManager
的用法示例。
在下文中一共展示了WebConfigurationManager.OpenMachineConfiguration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: OpenMachineConfiguration
' Show how to use OpenMachineConfiguration().
' It gets the machine.config file on the current
' machine and displays section information.
Shared Sub OpenMachineConfiguration1()
' Get the machine.config file on the current machine.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenMachineConfiguration()
' Loop to get the sections. Display basic information.
Console.WriteLine("Name, Allow Definition")
Dim i As Integer = 0
Dim section As ConfigurationSection
For Each section In config.Sections
Console.WriteLine((section.SectionInformation.Name + _
ControlChars.Tab + _
section.SectionInformation.AllowExeDefinition.ToString()))
i += 1
Next section
Console.WriteLine("[Total number of sections: {0}]", i)
' Display machine.config path.
Console.WriteLine("[File path: {0}]", config.FilePath)
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:23,代码来源:WebConfigurationManager.OpenMachineConfiguration
示例2: OpenMachineConfiguration
' Show how to use OpenMachineConfiguration(string).
' It gets the machine.config file applicabe to the
' specified resource and displays section
' basic information.
Shared Sub OpenMachineConfiguration2()
' Get the machine.config file applicabe to the
' specified reosurce.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenMachineConfiguration( _
"configTest")
' Loop to get the sections. Display basic information.
Console.WriteLine("Name, Allow Definition")
Dim i As Integer = 0
Dim section As ConfigurationSection
For Each section In config.Sections
Console.WriteLine((section.SectionInformation.Name + _
ControlChars.Tab + _
section.SectionInformation.AllowExeDefinition.ToString()))
i += 1
Next section
Console.WriteLine("[Total number of sections: {0}]", i)
' Display machine.config path.
Console.WriteLine("[File path: {0}]", config.FilePath)
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:26,代码来源:WebConfigurationManager.OpenMachineConfiguration
示例3: OpenMachineConfiguration
' Show how to use OpenMachineConfiguration(string, string).
' It gets the machine.config file on the specified server and
' applicabe to the specified reosurce and displays section
' basic information.
Shared Sub OpenMachineConfiguration3()
' Get the machine.config file applicabe to the
' specified reosurce and on the specified server.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenMachineConfiguration( _
"configTest", "myServer")
' Loop to get the sections. Display basic information.
Console.WriteLine("Name, Allow Definition")
Dim i As Integer = 0
Dim section As ConfigurationSection
For Each section In config.Sections
Console.WriteLine((section.SectionInformation.Name + _
ControlChars.Tab + _
section.SectionInformation.AllowExeDefinition.ToString()))
i += 1
Next section
Console.WriteLine("[Total number of sections: {0}]", i)
' Display machine.config path.
Console.WriteLine("[File path: {0}]", config.FilePath)
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:26,代码来源:WebConfigurationManager.OpenMachineConfiguration
示例4: OpenMachineConfiguration
' Show how to use OpenMachineConfiguration(string, string).
' It gets the machine.config file on the specified server,
' applicabe to the specified reosurce, for the specified user
' and displays section basic information.
Shared Sub OpenMachineConfiguration4()
' Get the current user token.
Dim userToken As IntPtr = _
System.Security.Principal.WindowsIdentity.GetCurrent().Token
' Get the machine.config file applicabe to the
' specified reosurce, on the specified server for the
' specified user.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenMachineConfiguration( _
"configTest", "myServer", userToken)
' Loop to get the sections. Display basic information.
Console.WriteLine("Name, Allow Definition")
Dim i As Integer = 0
Dim section As ConfigurationSection
For Each section In config.Sections
Console.WriteLine((section.SectionInformation.Name + _
ControlChars.Tab + _
section.SectionInformation.AllowExeDefinition.ToString()))
i += 1
Next section
Console.WriteLine("[Total number of sections: {0}]", i)
' Display machine.config path.
Console.WriteLine("[File path: {0}]", config.FilePath)
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:31,代码来源:WebConfigurationManager.OpenMachineConfiguration
示例5: OpenMachineConfiguration
' Show how to use OpenMachineConfiguration(string, string).
' It gets the machine.config file on the specified server,
' applicabe to the specified reosurce, for the specified user
' and displays section basic information.
Shared Sub OpenMachineConfiguration5()
' Set the user id and password.
Dim user As String = _
System.Security.Principal.WindowsIdentity.GetCurrent().Name
' Substitute with actual password.
Dim password As String = "userPassword"
' Get the machine.config file applicabe to the
' specified reosurce, on the specified server for the
' specified user.
Dim config As System.Configuration.Configuration = _
WebConfigurationManager.OpenMachineConfiguration( _
"configTest", "myServer", user, password)
' Loop to get the sections. Display basic information.
Console.WriteLine("Name, Allow Definition")
Dim i As Integer = 0
Dim section As ConfigurationSection
For Each section In config.Sections
Console.WriteLine((section.SectionInformation.Name + _
ControlChars.Tab + _
section.SectionInformation.AllowExeDefinition.ToString()))
i += 1
Next section
Console.WriteLine("[Total number of sections: {0}]", i)
' Display machine.config path.
Console.WriteLine("[File path: {0}]", config.FilePath)
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.Configuration,代码行数:33,代码来源:WebConfigurationManager.OpenMachineConfiguration