How to determine sql server security mode in .net?

Does anyone know how to define a security mode (mixed mode or Windows authentication) in .NET?

EDIT . I use regular ADO.NET objects (SqlConnection, SqlCommand, etc.) to connect to the database.

Thanks for any advice.

Steve

+3
source share
1 answer

You can request a 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

@keymay vary depending on your installation. I have several instances.

+1
source

Source: https://habr.com/ru/post/1772180/


All Articles