In the web.config file, add the following code: appsettings> In the page to be used, add two namespace for system.configuration; use system.data.sqlclient; then add these two lines of code in the code block: string con = configurationSettings.appsettings ["SqlConnectionstring" ]; SqlConnection conn = new sqlconnection (con);