App.Config File Question - Help

  • Thread starter Thread starter Yosh
  • Start date Start date
Y

Yosh

Morning!

I am developing an winform application in c#. I have an app.config file that
contains an entry with a Url address assigned to it. When I run my
application I get the following error:

The ':' character, hexadecimal value 0x3A, cannot be included in a name.

After doing some research, the problem is not the semi-colon. It's the
ampersand in the Url that is causing the error.

What is the problem? Can you not assign an & character to a string in the
App.Config? When I remove it, my application runs. I've tried rebooting and
everything.

Thanks,

Yosh
 
app.config is an XML document, some characters are illegal in XML (&, <, >,
probably others). You may have to HTMLEncode the values to store them
there. (& becomes &amp, etc.)

Just tried using the new "Settings Page, Project Desinger" in VS 2005. I
tried adding a url with an & in it. When I looked at the app.config file
(that is where it saves this stuff), I see it did convert it to &amp;

Greg
 
that should have been &amp; not &amp

Greg Burns said:
app.config is an XML document, some characters are illegal in XML (&, <,
there. (& becomes &amp, etc.)

Just tried using the new "Settings Page, Project Desinger" in VS 2005. I
tried adding a url with an & in it. When I looked at the app.config file
(that is where it saves this stuff), I see it did convert it to &amp;

Greg
 
Back
Top