Egil Hansen
Egil Hansen

Reputation: 15598

How can I load a config file from different assembly in asp.net?

I am using the Validation Application Block form the Enterprise Lib, and have my validation rules defined in a validation.config that is located in the same assembly as the entity objects (so I can use the same rules in both the backend and on the website).

But how do I get the validation.config from the entity assembly into the website assembly's web.config?

Upvotes: 0

Views: 718

Answers (1)

womp
womp

Reputation: 116977

If your question is about loading config files that are not the standard App.config or web.config files, the ConfigurationManager has a method that you can play around with.

System.Configuration.Configuration config =
     ConfigurationManager.OpenExeConfiguration(@"pathToFile\Config.dll");

This would try to load a file called Config.dll.config.

Upvotes: 1

Related Questions