Is it possible to have an ampersand sign in an appSettings key?
-
13-06-2021 - |
Domanda
I have the following appSettings section
<appSettings>
<add key="Foo" value="http://foo.bar.com/?app=xxx&FormName=yyy" />
</appSettings>
But the IDE is giving me two errors:
- Error 25 Entity 'FormName' not defined.
- Error 26 Expecting ';'.
It seems the & is causing a problem. I'd like to not have to splt the values up into seperate keys. Is there an elegant way around this issue?
Soluzione
You just need to use XML encoding here I believe - so &
becomes &
Altri suggerimenti
Try &
<appSettings>
<add key="Foo" value="http://foo.bar.com/?app=xxx&FormName=yyy" />
</appSettings>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow