Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, July 6, 2010 7:36 PM
I have a config file that looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="FourTFileWatcherFolder" value="C:\\TestFolder" />
<add key="FileTypes" value="*" />
<add key="PublicKey" value="<RSAKeyValue><Modulus>rIDn2vtrgtIBrM90+txm...5VgMrJquOdw==</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"/>
<add key="ConnectionString" value="Data Source=;Initial Catalog=;User ID=;Password="/>
</appSettings>
</configuration>
But my value field that has my public key has brackets in it. How do I handle this? I tried \ but it doesn't work.
All replies (2)
Thursday, July 8, 2010 2:02 AM ✅Answered
Hi chuckdawit,
Welcome to MSDN Forums!
I don’t think so the value can contain these tags,”<”,”>”. So you need take “<” instead of “<”, and take “>” instead of “>”.
And I don’t know if the tag,”<br/>”, behind each line is your opinion or could be a problem when the customer pasted the code in the forum post. You need to delete them. Otherwise the tag,” <br/>”, behind the root would make the application think there’s more than one root.
The code following has corrected, I think you will need it.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="FourTFileWatcherFolder" value="C:\TestFolder" />
<add key="FileTypes" value="*" />
<add key="PublicKey"
value="<RSAKeyValue><Modulus>rIDn2vtrgtIBrM90+txm...5VgMrJquOdw==
</Modulus><Exponent>AQAB</Exponent></RSAKeyValue>"/>
<add key="ConnectionString"
value="Data Source=;Initial Catalog=;User ID=;Password="/>
</appSettings>
</configuration>
These characters have special meaning in XML document. The application would explain these into xml tag not a value you want anywhere. So if you want to put them in the value filed you need the string behind them in the table following to replace.
Escaping characters of XML
< |
-> |
< |
> |
-> |
> |
" |
-> |
" |
' |
-> |
' |
& |
-> |
& |
If anything is unclear, don’t hesitate to get in touch. I look forward to your reply.
Regards,
Mike
Please remember:
Helpful à Mark as Answer
This can be beneficial to other community members reading the thread.
Tuesday, July 6, 2010 7:48 PM
What is the error?
btw I recommend when giving address using / instead so using "c:/testfolder" might do the trick
Regards