Config File Problem 
Author Message
 Config File Problem

I am succesfully using a config file for my application (very handy!).
However, I can't get it to read one config that I'm trying to put in there.
I'm trying to implement:
  <add key="MailFrom" value="IdeaWell

The problem is that it does not seem to like having the '<' or '>'
characters in there.  I get an error that reads
"'<', hexadecimal value 0x3C, is an invalid attribute character"

How can I get this done?

Thanks.
Josh



Mon, 27 Dec 2004 02:17:42 GMT  
 Config File Problem
I haven't tested this, but I'm pretty sure that you should escape the
special chars when using them als xml values. Try something like this:

 <add key="MailFrom" value="IdeaWell

When you retrieve the value in your app, .net is probably (!) smart enough
to decode it to give it to you with the < and >.

Hope it works...



Quote:
> I am succesfully using a config file for my application (very handy!).
> However, I can't get it to read one config that I'm trying to put in
there.
> I'm trying to implement:
>   <add key="MailFrom" value="IdeaWell

> The problem is that it does not seem to like having the '<' or '>'
> characters in there.  I get an error that reads
> "'<', hexadecimal value 0x3C, is an invalid attribute character"

> How can I get this done?

> Thanks.
> Josh



Mon, 27 Dec 2004 03:19:40 GMT  
 Config File Problem
Yes, escaping these characters is the correct method. As it is for all
XML documents. Both characters are part of the XML specification and so
will be processed.

Try to look up w3c.org for more information about xml and character
escaping, but I think .NET provides an Escape() method (don't know the
namespace right now).

Kind regards,
Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Mon, 27 Dec 2004 15:37:00 GMT  
 Config File Problem
Thankfully, I didn't have to try to figure out how to do a call to the
Escape method, as it did interpret things correctly when the config had the
HEX equivalent.

Thanks fo ryour help.
Josh


Quote:
> Yes, escaping these characters is the correct method. As it is for all
> XML documents. Both characters are part of the XML specification and so
> will be processed.

> Try to look up w3c.org for more information about xml and character
> escaping, but I think .NET provides an Escape() method (don't know the
> namespace right now).

> Kind regards,
> Michael

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Mon, 27 Dec 2004 20:10:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Problem with config files in VB.NET 2003

2. how to read from xml config ex: web.config

3. config file get deleted when I compile

4. several config files

5. Config File

6. .config file with smart client

7. reading web.config type file from windows service

8. CONFIG file rebuilt on every build

9. about app.config file

10. CONFIG files in VStudio 2003

11. Application won't use .config file

12. config file disappears when debuging

 

 
Powered by phpBB® Forum Software