I am writing IHttpFilter, which should be in a separate project (these are all C # projects), which will be used in the ASP.NET MVC application suite. In IHttpFilter, I have to define a few things that are specified in the web.config file.
Is there a way to get the current web.config file from an external assembly at runtime? There are three settings I need to get (strings).
Another problem is that I need to reference a bunch of files (images), but I'm not sure whether to place it in an ASPp MVC application or in an IHttpHandler project.
, , , -.
- , , - - web.config. IHttpHandler.
, , , , , , -. web.config.
: Ive, , Ive , , . bin -, , , .
, -.
, , web.config :
var configFile = new FileInfo(configPath); WebConfigurationFileMap map = new WebConfigurationFileMap(); var appBase = new VirtualDirectoryMapping(configFile.DirectoryName, true, configFile.Name); map.VirtualDirectories.Add("/", appBase); return WebConfigurationManager.OpenMappedWebConfiguration(map, "/");
configPath - , web.config.
configPath
Source: https://habr.com/ru/post/1718792/More articles:Itextsharp pdfpcell header - javaIs reusing GDI + objects a bad practice? (or: how to use many nested blocks without a headache?) - c #GDI + DashStyle throws an OutOfMemoryException in .NET. - .netHow to set row id [TR] and column id [TD] in displaytag? - javascriptOverriding styles defined in generic.xaml - wpfНе удается загрузить файл в Internet Explorer с помощью плагина JQuery Form - jqueryhow to write a php function - cThe difference between "Network path not found" and "Access denied" in C # - c #How to "expand" tags? - jqueryIntermittent problems with web services on a remote hosting server - c #All Articles