Saturday, March 31, 2012

Web Config <appSettings>

Hi, dear

Is it possible to add a key with value containing the concatenation of two words?
I'm trying to add a encripted password but the password has a the character Chr(34) (").
How can I solve this problem?

Thank you very much

ObedeObede,

What about replacing the double quote with some other character that is acceptable within <appSettings> but won't be found in the encrypted password. You could then use a regular expression to replace the character with the double quote when you read the setting.

For instance, if you replaced the double quote with a colon:


<appSettings>
<add key="test" value="abxq:asdfttt"></add>
</appSettings>

And then when you read the value, replace the colon with a double quote:

Dim actualPassword = Regex.Replace(ConfigurationSettings.AppSettings("test"), ":", """")

HTH,

cjmaxey
Hi, cjmaxey

I just tried it.
I want to know if there is another solution.
Thank you very much.

Obede
Place this caharcter refernce “ in XML file instead of ".

0 comments:

Post a Comment