Some of our users were facing connection problems after deploying their Asp application in our servers. This was due to the fact of a bad web.config configuration. In this article, I will give you a step by step guide on how to properly configure web.config to work with your ASP application.
Web.config file is the main configuration settings for a Web application in ASP.NET. The file is an XML document that defines configuration information regarding the web application. The web.config file contains information that control module loading, security settings, configurations session state, compile and the language of the application. Web.config files can also contain specific objects such as connection strings to the database.
First, let’s Initialize the file:
Inside the tag “configuration”, we locate the content of our web.config. If you are deploying an Asp application in our servers, the correct format for the data connection string is the following:
<add name=”MyDataBaseConnectionString_Name” connectionString=”Data Source="InsertServerNameHere";
Initial Catalog=MyDataBase; Integrated Security=false; User ID=myUSER; Password=mypassword”
Notice how the server name is inside quotes. Usually you write them like this (“”) however, for setting up the data connection source in the web.config file, those have to be written like this:
The connection string should be the same that you use on your Asp Application. Make sure they match or your application will not work.
This concludes how to properly configure web.config connection string and source