SQL Connection String Using a Domain User?

Have a look at connectionstrings.com for every possible variation – a very handy resource I use all the time Specifically, you want this format: Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI; This, of course, only works if the domain account in question is the one opening the connection. There’s no easy way to connect with arbitrary credentials – … Read more

Enabling Intellisense for Custom Sections in .config Files

As the other answers say, you need to provide an XML Schema document for your custom configuration section. There’s no need to add the .xsd schema file to some global directory; you can reference it directly from your custom section in the App.config file: <configuration> <!– make the custom section known to .NET’s configuration manager … Read more

Remove “Server” header from ASP.NET Core 2.1 application

This solution works on IIS 10+ version and allows to remove x-powered-by and server headers in server response. In IIS 10 a new attribute was added: removeServerHeader. We need to create web.config file in asp.net core application with following content: <?xml version=”1.0″ encoding=”utf-8″?> <configuration> <system.webServer> <security> <requestFiltering removeServerHeader=”true” /> </security> <httpProtocol> <customHeaders> <remove name=”X-Powered-By” /> … Read more

Setting multiple SMTP settings in web.config?

I needed to have different smtp configurations in the web.config depending on the environment: dev, staging and production. Here’s what I ended up using: In web.config: <configuration> <configSections> <sectionGroup name=”mailSettings”> <section name=”smtp_1″ type=”System.Net.Configuration.SmtpSection”/> <section name=”smtp_2″ type=”System.Net.Configuration.SmtpSection”/> <section name=”smtp_3″ type=”System.Net.Configuration.SmtpSection”/> </sectionGroup> </configSections> <mailSettings> <smtp_1 deliveryMethod=”Network” from=”mail1@temp.uri”> <network host=”…” defaultCredentials=”false”/> </smtp_1> <smtp_2 deliveryMethod=”Network” from=”mail2@temp.uri”> <network host=”1…” defaultCredentials=”false”/> … Read more

Why does .NET generate two web.config files in an MVC asp.net application?

This is an example of web.config file inheritance. From MSDN You can distribute ASP.NET configuration files throughout your application directories to configure ASP.NET applications in an inheritance hierarchy. This structure allows you to achieve the level of configuration detail that your applications require at the appropriate directory levels without affecting configuration settings at higher directory … Read more

VS 2015 RTM web.config The Global element ‘configuration’ has already been declared

Unfortunately, there are a number of situations that can cause this problem. The most likely problem though is that the schema for the document has been set incorrectly. This can happen when you install a newer version of .NET and/or Visual Studio on the computer. The fix is simple though. From the Visual Studio documentation: … Read more