Error parsing AppSettings value with a query string

前端 未结 3 1491
粉色の甜心
粉色の甜心 2021-02-05 10:05

In my AppSettings in web.config, I have something like this:


    

        
相关标签:
3条回答
  • 2021-02-05 10:43

    You can Try using & instead.

    0 讨论(0)
  • 2021-02-05 10:48

    In XML an ampersand tells the parser "the data immediately following this ampersand is an entity which needs to be translated." If the data immediately following is not a valid XML entity, then you get this error. If possible, use & for your ampersand within the XML.

    0 讨论(0)
  • 2021-02-05 11:08

    Replace & with & (escape it):

    <add
        key="ExternalSystemUrl"
        value="http://domain.com/page.aspx?id={0}&amp;action=eat&amp;object=bacon" />
    

    That's the common requirement for any valid XML file.

    See Where can I get a list of the XML document escape characters?

    0 讨论(0)
提交回复
热议问题