App.Config File Question - Help

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
 
G

Greg Burns

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
 
G

Greg Burns

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top