Saturday, November 14, 2015

An error occurred while parsing EntityName in asp.net

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

<appSettings>
    <add key="ExternalUrl" value="http://domain.com/samplepage.aspx?id={0}&action=xx" />
</appSettings>

However, it seems that when an ampersand (&) is included in an AppSettings value, ASP.NET throws the following error:

An error occurred while parsing EntityName.

Solution:
Replace & with &amp;

<add
    key="ExternalUrl"
    value="http://domain.com/samplepage.aspx?id={0}&amp;action=xx" />