1

I am practcing web.config file from here
when i copy and paste following code:

<configSections>
  <section name ="ProductSection" type ="<ProductSection" />
</configSections>

<ProductSection>
<gridSettings title ="Latest Products" count ="20"></gridSettings>
<color background="FFFFCC" foreground="FFFFFF"></color>
</ProductSection>

I got several errors like :

  • tag was not closed on second line.
  • </section> is missing.
  • the namespace 'section' can not include child element.

How to remove these errors and run it smoothly.

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86
Sohail
  • 574
  • 3
  • 21

2 Answers2

6

Instead of

<section name ="ProductSection" type ="<ProductSection" />

Try

<section name ="ProductSection" type ="&lt;ProductSection" />

See Which are the HTML, and XML, special characters?

Community
  • 1
  • 1
Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86
  • Thnx for help. It solved this issue but it says that " An error occurred creating the configuration section handler for ProductSection: Could not load type '
    – Sohail Oct 30 '13 at 09:46
  • @Sohail: You may have other similar problems i.e. other characters that may need to be escaped. Check the link in my answer. – Rui Jarimba Oct 30 '13 at 09:48
1

You have this:

type ="<ProductSection"

This is invalid in XML, get rid of the "<" character:

<section name ="ProductSection" type ="ProductSection" />

If you actually have something with "<", you'll have to encode it like so:

<section name ="ProductSection" type ="&lt;ProductSection" />

However as the actual section is <ProductSection> it was probably just a typo on your side.

Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208