web.config does not allow section names with dots

  • Thread starter Thread starter Vagif Abilov
  • Start date Start date
V

Vagif Abilov

Our .NET applications and Web sites use configuration files with custom
sections. It's no problem to read a section with dots in its name from a
Windows .NET application, e.g. "MyCompany.Product.Feature". However an
attempt to read such section from Web site's web.config file raises
exception ("Can not create section handler"). Once the dots are removed,
everything works fine. I have not found any documentation that describes
such behavior. Can anybody confirm this?

TIA

Vagif Abilov
Oslo Norway
vagif
@
online.no
 
Hi Vagif,

I tried to create a dotted config section in web.config, using a custon
configuration handler.

Everything is OK. I've not that error.

Can you paste the code you're using for the config handler?

Bye

Stefano
 
Hi Stefano,

Did you try it in a Web project? My section looks like this:

<configSections>
<section name="MyCompany.Workflow"
type="System.Configuration.NameValueSectionHandler" />
</configSections>

<appSettings>
<add key="Some key" value="Some value" />
</appSettings>

<MyCompany.Workflow>
<add key="MyKey" value="MyValue" />
</MyCompany.Workflow>

It works OK when I try to read configuration values from section
"MyCompany.Workflow" from Windows .NET application, but fails if I do the
same from ASP.NET application. However removing "." from the section name
helps.

Vagif
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top