Reputation: 9416
<appSettings>
<add key="myKeyName" value="DFG&y:yd%yeZ" />
</appSettings>
I have a web.config file in an ASP.NET MVC application. In my appSettings section, i have a key whose value contains a character that makes the web.config invalid.
The character is the "&" in value="DFG&y:yd%yeZ", if i remove it, the app works fine, when i put it back i get the error below.
Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: An error occurred while parsing EntityName. Line 25, position 61.
And my key below is highlighted in red.
<add key="myKeyName" value="DFG&y:yd%yeZ" />
Is the "&" prohibited in the a web.config's appSettings key Value?
Upvotes: 4
Views: 3613
Reputation: 2012
You need to replace the special char "&" by:
&
Here is a list of special chars
Upvotes: 5