Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Reading config file other than web.config

Reply
Thread Tools

Reading config file other than web.config

 
 
M Irfan
Guest
Posts: n/a
 
      04-17-2007
Recently I have started working in .NET 2.0. I am developing a web
service application that references a DLL component written in C# 2.0.
The component has its own config file which contains settings related
to business logic coded in that component. I can reference and load
the component but unable to read load the custom config file of that
component. I know that the same thing is possible if my host
application is any Exe application and using
"ExeConfigurationFileMap", "OpenMappedExeConfiguration" I can read
configuration file other than app.config but the same is not possible
if I use "WebConfigurationFileMap" and "OpenMappedWebConfiguration".
Using both these we can only define the mappings b/w virtual and
physical directories but can't read config file other than
web.config.

string dummyVirtualPath = "/test_web_2005";
string physicalPath = @"C:\Inetpub\wwwroot
\test_web_2005\Bin";
string configFileName =
System.IO.Path.GetFileName(assembly.CodeBase) + ".config";
WebConfigurationFileMap map = new WebConfigurationFileMap();
map.VirtualDirectories.Add(dummyVirtualPath, new
VirtualDirectoryMapping(physicalPath, true));
Configuration config =
WebConfigurationManager.OpenMappedWebConfiguration (map,
dummyVirtualPath);

Is there any other idea to implement the same. Thanks in advance.

Regards
Irfan

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      04-17-2007
See my response in the C# newsgroup. Actually, this is the best group for the
question, I just saw that one first.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




"M Irfan" wrote:

> Recently I have started working in .NET 2.0. I am developing a web
> service application that references a DLL component written in C# 2.0.
> The component has its own config file which contains settings related
> to business logic coded in that component. I can reference and load
> the component but unable to read load the custom config file of that
> component. I know that the same thing is possible if my host
> application is any Exe application and using
> "ExeConfigurationFileMap", "OpenMappedExeConfiguration" I can read
> configuration file other than app.config but the same is not possible
> if I use "WebConfigurationFileMap" and "OpenMappedWebConfiguration".
> Using both these we can only define the mappings b/w virtual and
> physical directories but can't read config file other than
> web.config.
>
> string dummyVirtualPath = "/test_web_2005";
> string physicalPath = @"C:\Inetpub\wwwroot
> \test_web_2005\Bin";
> string configFileName =
> System.IO.Path.GetFileName(assembly.CodeBase) + ".config";
> WebConfigurationFileMap map = new WebConfigurationFileMap();
> map.VirtualDirectories.Add(dummyVirtualPath, new
> VirtualDirectoryMapping(physicalPath, true));
> Configuration config =
> WebConfigurationManager.OpenMappedWebConfiguration (map,
> dummyVirtualPath);
>
> Is there any other idea to implement the same. Thanks in advance.
>
> Regards
> Irfan
>
>

 
Reply With Quote
 
 
 
 
M Irfan
Guest
Posts: n/a
 
      04-18-2007
On Apr 17, 6:02 pm, Peter Bromberg [C# MVP]
<(E-Mail Removed)> wrote:
> See my response in the C# newsgroup. Actually, this is the best group for the
> question, I just saw that one first.
> Peter
>
> --
> Site: http://www.eggheadcafe.com
> UnBlog: http://petesbloggerama.blogspot.com
> Short urls & more: http://ittyurl.net
>
>
>
>
>
> "M Irfan" wrote:
> > Recently I have started working in .NET 2.0. I am developing a web
> > service application that references a DLL component written in C# 2.0.
> > The component has its ownconfigfilewhich contains settings related
> > to business logic coded in that component. I can reference and load
> > the component but unable to read load the customconfigfileof that
> > component. I know that the same thing is possible if my host
> > application is any Exe application and using
> > "ExeConfigurationFileMap", "OpenMappedExeConfiguration" I can read
> > configurationfileotherthanapp.configbut the same is not possible
> > if I use "WebConfigurationFileMap" and "OpenMappedWebConfiguration".
> > Using both these we can only define the mappings b/w virtual and
> > physical directories but can't readconfigfileotherthan
> >web.config.

>
> > string dummyVirtualPath = "/test_web_2005";
> > string physicalPath = @"C:\Inetpub\wwwroot
> > \test_web_2005\Bin";
> > string configFileName =
> > System.IO.Path.GetFileName(assembly.CodeBase) + ".config";
> > WebConfigurationFileMap map = new WebConfigurationFileMap();
> > map.VirtualDirectories.Add(dummyVirtualPath, new
> > VirtualDirectoryMapping(physicalPath, true));
> > Configurationconfig=
> > WebConfigurationManager.OpenMappedWebConfiguration (map,
> > dummyVirtualPath);

>
> > Is there anyotheridea to implement the same. Thanks in advance.

>
> > Regards
> > Irfan


Hi Peter,

Thanks for the response. I know that I can use web.config but I dont
want to use that. The component will be reponsible for sending data to
multiple partners and at run time partner specific object would be
instantiated using Reflection. For the time being I think its should
use a custom config reader. Design wise I believe it would be good if
objects and their configurations are laoded dynamically without being
depended on web.config.

Regards
Irfan.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
section with in a section config file and reading that config file kampy Python 9 10-19-2012 10:59 PM
authorization - other than web.config? Chang Lui ASP .Net 1 05-10-2007 10:15 PM
dll config and web.config and Label Expressions (binding label text to dll config settings) CSharpner ASP .Net 0 04-09-2007 09:00 PM
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
How to access web.sitemap file from other virtual directories other than the current application root folder? hvajja@gmail.com ASP .Net 0 08-07-2006 08:26 PM



Advertisments