Ask a Question related to ASP.NET Web Services, Design and Development.
-
Stevet96 #1
Web.Config and appSettings tag
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+abzzXG bUIOV1DVRY3RUt3Nozg8STBo6pFscRROzshjtheWwsmkQcEv4B Usnj2Fxpv41hBLW45tGIyAKraHT19PCbbglkBu7jRZgRcj32I/FnoBotRrNcOdKpXuQep17U7qVw44=" />
<add key="SqlConnection"
value="gGVy3Wyj1YSs7sIHEEqsR0NdShs27Wf+VhRHPigbR44 2cuoTAstzHWTRzeaNLwnfxISqske9+rQiKGqJupJkLYemi9XvM wsXLVByokEZixrr/PUlsmDMJIGhPc9dZFzIYsn9PUPfKD63ieGFKv76QKiMIbIbOQZ yPMoaMWovIWJNmYwfDWZhOvO2pVvK9lxxiaC1Xe58wd54EYc/4JNwQxv2ugDiY167tJQL88ADBc+4rOwyYN093CaITBKtF7H3Ng aQZWeIE9rSr+/5pbn1I+54BirRo4bproDoi0/vxrFV1oFXJuDKJLxc8PtM6JeCqjpBPFFskXsFoFXOLI5YGNyCN QbmOFqllWTFW8p9U+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
Stevet96 Guest
-
How secure are appsettings in web.config?
Just wondering how safe it is to include sensitive information such as a database connection string in web.config. -
How: Ampersand in AppSettings value??
I am wondering how i can put an ampersand character into the value attribute of a key in the appSettings section of my web.config file. If i try to... -
Intermittent problem reading appSettings in Web.Config
Are you positive this is a web config issue? You yourself say you don't know what is being returned. When you resave web.config, this restarts... -
appSettings problem!
Hello! I have one problem with the appSettings on win2k srv machine with framework 1.1. Following line not work anymore (it worked fine with... -
ConfigurationSettings.AppSettings Error
Hello Chris, When you are experiencing this problem? What are you including in the AppSettings Config file. Are you using long string? What... -
Stevet96 #2
RE: Web.Config and appSettings tag
I just love it when you answer your own post. It turns out that an object
that was using the connection string was somehow being initialized before I
even got into my webservice function. Not sure how that happens since it
shouldn't be loaded until I call new on it. Anyway, I stopped the object
from reading in the encrypted text before it was decrypted.
Thanks,
Steve
"Stevet96" wrote:
> 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+abzzXG bUIOV1DVRY3RUt3Nozg8STBo6pFscRROzshjtheWwsmkQcEv4B Usnj2Fxpv41hBLW45tGIyAKraHT19PCbbglkBu7jRZgRcj32I/FnoBotRrNcOdKpXuQep17U7qVw44=" />
> <add key="SqlConnection"
> value="gGVy3Wyj1YSs7sIHEEqsR0NdShs27Wf+VhRHPigbR44 2cuoTAstzHWTRzeaNLwnfxISqske9+rQiKGqJupJkLYemi9XvM wsXLVByokEZixrr/PUlsmDMJIGhPc9dZFzIYsn9PUPfKD63ieGFKv76QKiMIbIbOQZ yPMoaMWovIWJNmYwfDWZhOvO2pVvK9lxxiaC1Xe58wd54EYc/4JNwQxv2ugDiY167tJQL88ADBc+4rOwyYN093CaITBKtF7H3Ng aQZWeIE9rSr+/5pbn1I+54BirRo4bproDoi0/vxrFV1oFXJuDKJLxc8PtM6JeCqjpBPFFskXsFoFXOLI5YGNyCN QbmOFqllWTFW8p9U+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,
> SteveStevet96 Guest



Reply With Quote

