<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <!-- Section handlers for configuration settings -->
    <sectionGroup name="system.net">
      <section name="settings" type="System.Net.Configuration.SettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    </sectionGroup>
  </configSections>

  <!-- App settings for all .NET applications -->
  <appSettings>
    <!-- Example of username and password in appSettings -->
    <add key="ApplicationUsername" value="myAppUser" />
    <add key="ApplicationPassword" value="myAppPassword" />
  </appSettings>
    
  <!-- OAuth/Token-Based Service Endpoints -->
  <appSettings>
  <add key="OAuthServiceUrl" value="https://oauth.example.com/token" />
  <add key="ClientId" value="myClientId" />
  <add key="ClientSecret" value="myClientSecret" />
  </appSettings>
  
   <!--  WebClient or HttpClient Credentials -->
   <appSettings>
	  <add key="ServiceUrl" value="https://service.example.com/api" />
	  <add key="ServiceUserName" value="serviceUser" />
	  <add key="ServicePassword" value="servicePassword" />
   </appSettings>   
 
  <!-- AppSettings Section -->
  <appSettings>
	  <add key="ApiEndpoint" value="https://api.example.com/endpoint" />
	  <add key="ApiUserName" value="apiUser" />
	  <add key="ApiPassword" value="apiPassword" />
  </appSettings> 
  
  <!-- Custom Sections for Service Credentials -->
  <configSections>
	  <section name="serviceCredentials" type="System.Configuration.NameValueSectionHandler" />
  </configSections>

  <serviceCredentials>
	  <add key="ServiceUrl" value="https://customservice.example.com" />
	  <add key="UserName" value="customUser" />
	  <add key="Password" value="customPassword" />
  </serviceCredentials>   

  <!-- Connection string settings -->
  <connectionStrings>
    <!-- SQL Server (Standard Authentication) -->
    <add name="SqlServerConnection"
         connectionString="Data Source=localhost;Initial Catalog=myDB;User ID=myUser;Password=myPass;"
         providerName="System.Data.SqlClient" />

    <!-- SQL Server (Windows Authentication) -->
    <add name="SqlServerIntegratedSecurity"
         connectionString="Data Source=localhost;Initial Catalog=myDB;Integrated Security=True;"
         providerName="System.Data.SqlClient" />

    <!-- SQL Server (Encrypted Connection) -->
    <add name="SqlServerEncryptedConnection"
         connectionString="Data Source=localhost;Initial Catalog=myDB;User ID=myUser;Password=myPass;Encrypt=True;TrustServerCertificate=False;"
         providerName="System.Data.SqlClient" />

    <!-- MySQL (Standard Connection) -->
    <add name="MySqlConnection"
         connectionString="Server=localhost;Database=myDB;User=myUser;Password=myPass;"
         providerName="MySql.Data.MySqlClient" />

    <!-- MySQL (SSL/Encrypted Connection) -->
    <add name="MySqlConnectionWithSSL"
         connectionString="Server=localhost;Database=myDB;User=myUser;Password=myPass;SslMode=Required;"
         providerName="MySql.Data.MySqlClient" />

    <!-- PostgreSQL (Standard Connection) -->
    <add name="PostgreSqlConnection"
         connectionString="Host=localhost;Port=5432;Database=myDB;Username=myUser;Password=myPass;"
         providerName="Npgsql" />

    <!-- Oracle (Standard Connection) -->
    <add name="OracleConnection"
         connectionString="Data Source=MyOracleDB;User Id=oracleUser;Password=oraclePass;"
         providerName="System.Data.OracleClient" />

    <!-- Oracle (TNS Connection) -->
    <add name="OracleTNSConnection"
         connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=myService)));User Id=oracleUser;Password=oraclePass;"
         providerName="Oracle.ManagedDataAccess.Client" />

    <!-- SQLite (No Authentication Required) -->
    <add name="SQLiteConnection"
         connectionString="Data Source=myDatabase.db;"
         providerName="System.Data.SQLite" />

    <!-- Microsoft Access (OLEDB with username and password) -->
    <add name="AccessConnection"
         connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myAccessFile.accdb;User Id=admin;Password=myPass;"
         providerName="System.Data.OleDb" />

    <!-- Azure SQL (Standard SQL Authentication) -->
    <add name="AzureSqlConnection"
         connectionString="Server=tcp:myserver.database.windows.net,1433;Initial Catalog=myDB;Persist Security Info=False;User ID=myUser;Password=myPass;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

  <!-- Compilation settings for applications -->
  <system.web>
    <compilation debug="false" />
    <authentication mode="Forms">
      <!-- Forms authentication with username and password -->
      <forms loginUrl="login.aspx" timeout="30">
        <credentials passwordFormat="Clear">
          <user name="user1" password="password1" />
          <user name="user2" password="password2" />
        </credentials>
      </forms>
    </authentication>
    <customErrors mode="Off" />
  </system.web>

  <!-- Machine-wide database settings -->
  <system.data>
    <DbProviderFactories>
      <add name="Microsoft SQL Server Compact Data Provider"
           invariant="System.Data.SqlServerCe.4.0"
           description=".NET Framework Data Provider for Microsoft SQL Server Compact"
           type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </DbProviderFactories>
  </system.data>

  <!-- Credentials for SMTP (system.net) -->
  <system.net>
    <mailSettings>
      <smtp from="you@example.com">
        <network host="smtp.example.com" port="587"
                 userName="smtpUser"
                 password="smtpPassword"
                 defaultCredentials="false" />
      </smtp>
    </mailSettings>
  </system.net>

  <!-- Global assembly cache settings -->
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  <!-- Logging and tracing settings -->
  <system.diagnostics>
    <sources>
      <source name="System.Net" switchValue="Verbose">
        <listeners>
          <add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
  
	<!-- WCF (Windows Communication Foundation) Service Bindings  -->
	<system.serviceModel>
	  <bindings>
		<basicHttpBinding>
		  <binding name="MyBinding">
			<security mode="Transport">
			  <transport clientCredentialType="Basic" />
			</security>
		  </binding>
		</basicHttpBinding>
	  </bindings>
	  <client>
		<endpoint address="https://example.com/service"
				  binding="basicHttpBinding"
				  bindingConfiguration="MyBinding"
				  contract="IMyService" />
	  </client>
	  <behaviors>
		<endpointBehaviors>
		  <behavior>
			<clientCredentials>
			  <userName userName="serviceUser" password="servicePassword" />
			</clientCredentials>
		  </behavior>
		</endpointBehaviors>
	  </behaviors>
	</system.serviceModel>  
</configuration>
