Going through legacy apps written in multiple .NET framework languages (ASP.NET, VB, C#), I always find in their app.config or web.config connection strings with hardcoded and working username and passwords to various SQL Server and IBM databases. There are a huge number of questions on this site about protecting these but what is the reason for storing such information in configuration files when the app also asks for authentication? and do these users (the hardcoded users not the ones who enter credentials) appear in the databases audit logs every time I build and run it?
It's likely that these legacy applications rely on ADO.NET for database connection. The default ConnectionString property includes server name, database name, username and password. A more secure version would be using Windows Authentication to connect to the database instance, which will use the "Integrated Security" tag instead of username and password.
what is the reason for storing such information in configuration files when the app also asks for authentication?
This is unclear. Did you mean that:
or
and do these users appear in the databases audit logs every time I build and run it?
Not by default unless you setup DDL/DML/login trigger inside the database server to specifically track database connection.