Does anyone know how to determine the security mode (Mixed Mode or Windows Authentication) in .NET?
有谁知道如何确定.NET中的安全模式(混合模式或Windows身份验证)?
EDIT: I am using normal ADO.NET objects (SqlConnection, SqlCommand, etc) to connect to the database.
编辑:我使用正常的ADO.NET对象(SqlConnection,SqlCommand等)连接到数据库。
Thanks for any and all advice.
感谢您的任何建议。
Steve
1 个解决方案
#1
1
You can query the registry!
你可以查询注册表!
DECLARE @LoginMode int
EXEC master..xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\',
@value_name = 'LoginMode',
@value = @LoginMode output
PRINT @LoginMode
1 = SQL
2 = Mixed
1 = SQL 2 =混合
The @key
may be different depending on your installation. I have a couple instances running.
@key可能因安装而异。我有几个实例在运行。
#1
1
You can query the registry!
你可以查询注册表!
DECLARE @LoginMode int
EXEC master..xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = 'SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer\',
@value_name = 'LoginMode',
@value = @LoginMode output
PRINT @LoginMode
1 = SQL
2 = Mixed
1 = SQL 2 =混合
The @key
may be different depending on your installation. I have a couple instances running.
@key可能因安装而异。我有几个实例在运行。