i

ASP.Net A Complete Guide

Connection String Storage

ASP.NET 2.0 introduced a new section in the configuration file(web.config) that allows us to store connection strings that can be read at runtime. The section makes it easy to store connection strings.

Example:

 

Below is the syntax to set the ConnectionString attribute for the server control.

Syntax:

ConnectionString="<%$ ConnectionStrings:Testdatabase%>"

We can encrypt the connection string so that sensitive information will not get easily exposed to the outside user.