Web.Config and appSettings tag

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Stevet96 (Stevet96_at_discussions.microsoft.com)
Date: 01/07/05


Date: Fri, 7 Jan 2005 10:57:02 -0800

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



Relevant Pages

  • RE: Web.Config and appSettings tag
    ... that was using the connection string was somehow being initialized before I ... > The values are encrypted using the encryption available in .NET. ... > following error message "Format of the initialization string does not conform ... > at the beginning of the web service function. ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: VB2005 - Secure Access to SQL Server through Application Only
    ... My question is when I should be modifying the connection string and is there any way to insert something into the string to make it use an application role? ... Also have a look at the various Encryption classes. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: ADO connections question
    ... Function CreateADOObjects(ConnectionString as string) ... you'll see this error if the connection has not been ... I have a specific login form that calls the dbLogin function as shown ... Dim strCriteria As String ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Byte array to string and back - newbie question
    ... // Create a symmetric algorithm. ... This is done to make encryption more ... // Encrypt a string into a string using a password ... // Decrypt a byte array into a byte array using a key and an IV ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Using Python To Create An Encrypted Container
    ... an encrypted archive utility designed for secure archiving ... A match string allows you to only extract files matching a given ... Encrypt the string s using passwd and encryption cipher enc ...
    (comp.lang.python)