S
Stevet96
I am storing a database connection string in a key/value pair in the
appSettings tag of the web.config file as follows:
<appSettings>
<add key="DB2Connection"
value="NU2xZIOswP0Ar7fyDzqFCalmIx1tGDvVt92I+abzzXGbUIOV1DVRY3RUt3Nozg8STBo6pFscRROzshjtheWwsmkQcEv4BUsnj2Fxpv41hBLW45tGIyAKraHT19PCbbglkBu7jRZgRcj32I/FnoBotRrNcOdKpXuQep17U7qVw44=" />
<add key="SqlConnection"
value="gGVy3Wyj1YSs7sIHEEqsR0NdShs27Wf+VhRHPigbR442cuoTAstzHWTRzeaNLwnfxISqske9+rQiKGqJupJkLYemi9XvMwsXLVByokEZixrr/PUlsmDMJIGhPc9dZFzIYsn9PUPfKD63ieGFKv76QKiMIbIbOQZyPMoaMWovIWJNmYwfDWZhOvO2pVvK9lxxiaC1Xe58wd54EYc/4JNwQxv2ugDiY167tJQL88ADBc+4rOwyYN093CaITBKtF7H3NgaQZWeIE9rSr+/5pbn1I+54BirRo4bproDoi0/vxrFV1oFXJuDKJLxc8PtM6JeCqjpBPFFskXsFoFXOLI5YGNyCNQbmOFqllWTFW8p9U+HSGNKus8qVjLj5oDxvyC3x/HyDKP3K3sR7MgJek+ftTw==" />
</appSettings>
The values are encrypted using the encryption available in .NET. When I
only have the first key/value pair in appSettings, the ASP.NET web service
works fine including the decrypting of the value and the subsequent DB
connection. When I added the second key/value pair, I started to get the
following error message "Format of the initialization string does not conform
to specification starting at index 0." I did a search and the first thing
that I made sure was that I was correctly decrypting the string. However
when I went to debug the webservice, I was not able hit a break point even
at the beginning of the web service function. The web service is not able to
load the web.config file to use. I then tried to store the connection
string in plain text (unencrypted) in the value and the webservice worked
including connecting to the database. It appears that there is some issue
with the encrypted string. I tried to encrypt the connection string using a
different encryption key to generate a different value, but that also
generated the same error.
Is there is limit to the length a value can be in the appSettings tag? Is
there some sort of format issue that I dont see? Again if I take the second
key/value out the web service runs just fine. I used the same encryption
technique for both key/value pairs.
Thanks for your help,
Steve
appSettings tag of the web.config file as follows:
<appSettings>
<add key="DB2Connection"
value="NU2xZIOswP0Ar7fyDzqFCalmIx1tGDvVt92I+abzzXGbUIOV1DVRY3RUt3Nozg8STBo6pFscRROzshjtheWwsmkQcEv4BUsnj2Fxpv41hBLW45tGIyAKraHT19PCbbglkBu7jRZgRcj32I/FnoBotRrNcOdKpXuQep17U7qVw44=" />
<add key="SqlConnection"
value="gGVy3Wyj1YSs7sIHEEqsR0NdShs27Wf+VhRHPigbR442cuoTAstzHWTRzeaNLwnfxISqske9+rQiKGqJupJkLYemi9XvMwsXLVByokEZixrr/PUlsmDMJIGhPc9dZFzIYsn9PUPfKD63ieGFKv76QKiMIbIbOQZyPMoaMWovIWJNmYwfDWZhOvO2pVvK9lxxiaC1Xe58wd54EYc/4JNwQxv2ugDiY167tJQL88ADBc+4rOwyYN093CaITBKtF7H3NgaQZWeIE9rSr+/5pbn1I+54BirRo4bproDoi0/vxrFV1oFXJuDKJLxc8PtM6JeCqjpBPFFskXsFoFXOLI5YGNyCNQbmOFqllWTFW8p9U+HSGNKus8qVjLj5oDxvyC3x/HyDKP3K3sR7MgJek+ftTw==" />
</appSettings>
The values are encrypted using the encryption available in .NET. When I
only have the first key/value pair in appSettings, the ASP.NET web service
works fine including the decrypting of the value and the subsequent DB
connection. When I added the second key/value pair, I started to get the
following error message "Format of the initialization string does not conform
to specification starting at index 0." I did a search and the first thing
that I made sure was that I was correctly decrypting the string. However
when I went to debug the webservice, I was not able hit a break point even
at the beginning of the web service function. The web service is not able to
load the web.config file to use. I then tried to store the connection
string in plain text (unencrypted) in the value and the webservice worked
including connecting to the database. It appears that there is some issue
with the encrypted string. I tried to encrypt the connection string using a
different encryption key to generate a different value, but that also
generated the same error.
Is there is limit to the length a value can be in the appSettings tag? Is
there some sort of format issue that I dont see? Again if I take the second
key/value out the web service runs just fine. I used the same encryption
technique for both key/value pairs.
Thanks for your help,
Steve