I just recently discovered that there are differences in the web.config file of a development environment to that of a production environment. I was reading articles about this and did not fully understand it.
https://learn.microsoft.com/en-us/previous-versions/dd465326(v=vs.100)?redirectedfrom=MSDN
https://learn.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/common-configuration-differences-between-development-and-production-cs
I thought that when using the "Publish" option in "Build" menu, it will automatically do the necessary changes in the web.config (like changing the compilation debug="true"), apart from the connection string, mail settings and SessionState.
In one of the articles, I read a line where it is stated that Visual Studio can automatically do the necessary changes when we use the publish tool from VS, please, is that true?
I will please like to get a clarity on this and also, if possible, a brief step-by-step direction on the things that needs to be done in my own web.config file?
Thank you.
Here is a sample of my ASP.NET Web Application web.config
<configuration>
<connectionStrings>
<add name="ConString" connectionString="MyConnectionString" />
</connectionStrings>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
<system.web>
<sessionState timeout="120"></sessionState>
<authentication mode="Forms">
<forms name="login" timeout="120" cookieless="UseCookies" loginUrl="Login.aspx" slidingExpiration="true" />
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" maxRequestLength="3145728" />
<customErrors mode="Off" />
<pages enableEventValidation="false">
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="emailaddress@mymail.com">
<network host="smtp.secureserver.net" port="20" enableSsl="false" userName="emailaddress@mymail.com" password="password" defaultCredentials="false" />
</smtp>
</mailSettings>
</system.net>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="819200000">
</jsonSerialization>
</webServices>
</scripting>
</system.web.extensions>
<location path="Signup.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
<system.codedom>
<compilers>
<compiler extension=".cs" language="c#;cs;csharp" warningLevel="4" compilerOptions="/langversion:7.3 /nowarn:1659;1699;1701;612;618" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<compiler extension=".vb" language="vb;vbs;visualbasic;vbscript" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008,40000,40008 /define:_MYTYPE=\"Web\" /optionInfer+" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</compilers>
</system.codedom>
</configuration>