ASP NET - Connection String nesnesi olusturmak Web Config Dosyasi

10.04.2017

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->

<configuration>
  <appSettings>
    <add key="webpages:Version" value="4.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
    <add key="connectionStringName" value="vt_fd" />
  </appSettings>
  <connectionStrings>
    <add name="ayson" connectionString="Server=mssql.aysunyildirim.xyz\MSSQLSERVER2012;Database=aysunyildirim_;uid=aysunyildirim;pwd=aysun02;pooling=true;max pool size=10000; MultipleActiveResultSets=True;" />
  </connectionStrings>
  <system.web>

    <pages enableEventValidation="false" validateRequest="false" enableViewStateMac="false" >
    </pages>
    <httpRuntime executionTimeout="24000" maxRequestLength="30480" />
    <membership>
      <providers>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
      </providers>
    </membership>
    <profile>
      <providers>
        <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </profile>
    <roleManager>
      <providers>
        <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
      </providers>
    </roleManager>


    <globalization requestEncoding="windows-1254" responseEncoding="windows-1254" culture="tr-TR" uiCulture="tr" fileEncoding="windows-1254"/>

    <compilation debug="true" strict="true" explicit="true" batch="true"
                 optimizeCompilations="true" batchTimeout="900"
                 maxBatchSize="1000" maxBatchGeneratedFileSize="1000"
                 numRecompilesBeforeAppRestart="15" defaultLanguage="C#"
                 targetFramework="4.0" assemblyPostProcessorType="">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>

    </compilation>

    <customErrors mode="Off">

    </customErrors>

  </system.web>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
    </security>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />

    <urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true" />


  </system.webServer>

</configuration>
 

 

 

web.config dosyasi içerigi yukarida yer aldigi sekilde olacaktir. kendi web sitenize göre kullanici ismi veritabani ismi ve sifreleri degistirmelisiniz. 

aspx sayfalarimizda kod kisminda ise  kütüphanemiz ekleyecegiz

using System.Configuration;

daha sonra page_load tan önce 
        string vtbag = ConfigurationManager.ConnectionStrings["ayson"].ConnectionString;

satirini yaziyoruz. 

bundan sonraki kisimda veritabani baglantisini yapacagimiz local baglanti noktasi yerine vtbag yazarak baglantimizi gerçeklestirmek olacaktir. 

     
            SqlConnection baglan = new SqlConnection(vtbag);
            baglan.Open();



Adınız Soyadınız
İçerik
Son Eklenenler Konular
  • E-Ticaret çalismasi Satis sitesi
  • 2017-2018 Normal Ögretim Konu Anlatim Listesi
  • Asp Net- Veritabani Olusturma ve GridView Ekleme Kayit
  • Asp Net-Master page ile admin paneli
  • Vize 2 Mesleki Yabanci Dil 1
  • Vize 2 için Ag temelleri
  • Vize2 Internet Programciligi I
  • Vize 2 için ödev listesi- Programlamanin Temelleri
  • Programlamanin Temelleri Akis Diyagramlari Örnekleri
  • Bilgisayar Aglari-Ag Temelleri
  • Bilgisayar Mesleki Yabanci Dil Dersi Için Kelimeler 1
  • 2015-2016 Staj Kabul Listesi
  • 2016-2017 Yaz Staji Yapacaklarin Listesi
  • ASP NET ile veritabanindaki alani gösterirken kisaltarak görüntüleme
  • ASP NET - Plesk ile veritabani olusturma ve MS SQL veritabani olusturma islemleri
  • Dreamveaver
  • ASP Net
  • CSS
  • Html
  • Visual Studio C# ve C Console
  • Programlamanin Temelleri-Algoritma
  • Mesleki Yabancı Dil
  • Windows Server 2012
  • Ag Temelleri-Bilgisayar Aglari
  • Staj
  • Copyright (c) Ferdi DOĞAN