Phill Greggan
Phill Greggan

Reputation: 2394

Where does app.config belong?

i have a winforms app, the solution has two projects client (winforms) and the business logic(as Library classes). When i create a datset.xsd file in the client, it adds app.config file to the client. but why it adds it in the client?

App.config which contains the connection string should belong in the business logic (in the Library classes) because the business logic layer is the layer that accesses the database. To my understanding the the connection string part of the app.config should be encrypted. But why this app.config is placed in the client where the security risk is high, why typically developers do not place it in the business layer?

Upvotes: 1

Views: 330

Answers (1)

Sergey
Sergey

Reputation: 3213

Configuration file App.config is for the entire application configuration not per library. Like Davin mentioned it's not a physical separation but rather logical where all libraries still get placed into the same folder when you compile an application and the main app.config file from the assembly that runs an application is used for getting configuration data for your application.

The file is not encrypted by default but it can be. Here is a thread that lists different ways of encrypting the web.config configuration data.

Encrypting appSettings in web.config

And here is a blog post about encrypting app.config file

http://weblogs.asp.net/jongalloway//encrypting-passwords-in-a-net-app-config-file

Upvotes: 6

Related Questions