zoukankan      html  css  js  c++  java
  • A typical ASP.NET 2.0 Configuration Settings

    A typical ASP.NET 2.0 Configuration Settings

     

    Posted by: Rickie http://rickie.cnblogs.com

    ASP.NET web application configuration is stored in a web.config file. This file is used to describe the properties and behaviors of various aspects of ASP.NET application.

     

    A typical ASP.NET 2.0 web configuration file is as follows.

     

    < configuration xmlns = "http://schemas.microsoft.com/.NetConfiguration/v2.0">

      < connectionStrings >

        < add name = "ConnectionStr1"  connectionString="Server=(local); Database=aspnetdb; User ID=sa; Password=developer" />

      </ connectionStrings >

     

      < system.web >

             < profile defaultProvider = "SqlProvider">

          < providers >

            < clear />

            < add name = "SqlProvider"

                  connectionStringName = "ConnectionStr1"applicationName="TestApp"

                  type = "System.Web.Profile.SqlProfileProvider"

                  description = "SqlProfileProvider for SampleApplication"

             />

          </ providers >

          < properties >

                                < add name = "FirstName"/>

                                < add name = "LastName"/>

                                < add name = "LastVisited"/>

                                < add name = "Age"/>

                                < add name = "Member"/>

                         </ properties >

           </ profile >

       

        < membership defaultProvider = "SqlProvider">

          < providers >

            < clear />

            < add name = "SqlProvider"

              type = "System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"

             connectionStringName = "ConnectionStr1"

             requiresQuestionAndAnswer = "false"

             requiresUniqueEmail = "true"

             passwordFormat = "Clear"

             minRequiredNonalphanumericCharacters = "0"

             minRequiredPasswordLength = "3" />

          </ providers >

        </ membership >

     

        < roleManager enabled = "true"  defaultProvider="SqlProvider" >

          < providers >

            < clear />

            < add name = "SqlProvider"

               type = "System.Web.Security.SqlRoleProvider"

               connectionStringName = "ConnectionStr1"

           />

          </ providers >

        </ roleManager >

       

        < authentication mode = "Forms">

          < forms name = ".ASPXAUTH"loginUrl="Login.aspx"

                 protection = "All"

                 timeout = "30"

                 path = "/"

                 requireSSL = "false"

                 slidingExpiration = "true"

            />

        </ authentication >

       

           < sessionState

          mode = "InProc"

          stateConnectionString = "tcpip=127.0.0.1:42424"

          stateNetworkTimeout = "10"

          sqlConnectionString = "data source=127.0.0.1; user id=sa; password=P@55worD"

          cookieless = "false"

          timeout = "20"

    />

     

           < compilation debug = "true"/>

     

        <!-- trace enabled ="true" pageOutput="true" / -->

      </ system.web >

    </ configuration >

     

    1. connectionStrings Section

    ASP.NET 2.0 introduces a new section called <connectionStrings> that stores all kinds of connection-string information.

     

    How to retrieve a connection string:

    ConfigurationSettings.ConnectionStrings[“ ConnectionStr1];

     

    2. profile Section

    Profile section configures parameters for managing user profile values by using the ASP.NET profile.

    The above sample shows how to configure an ASP.NET application to use to SqlProvider store data.

     

    3. membership Section

    In the above sample, we specify the default membership provider using the defaultProvider attribute of the membership element. The SqlProvider provider connects to a database server specified by the ConnectionStr1 element in <connectionStrings> section.

     

    4. roleManager Section

    The <roleManager> section configures an application for role management. The default role provider is specified as SqlProvider in the above sample, which connect to the same database server as the membership element.

     

    5. authentication

    Authentication is a process that verifies the identity of the user and establishes the identity between the server and a request.

    ASP.NET 2.0 supports the following authentication methods.

    Windows authentication / Passport / Forms

     

    6. sessionState

    ASP.NET 2.0 has the capability to persit the session store data in InProc, StateServer, SqlServer and Custom.

     

    References:

    1. MSDN

    2. Professional ASP.NET 2.0 – Wrox

     

  • 相关阅读:
    游戏资源贴
    赠云风大侠
    微软ad域的初步认识
    WAMP 80端口被MicrosoftHTTPAPI/2.0占用的解决办法
    单点登录的一系列尝试及最终解决
    母版页缓存问题
    Vs2012如何创建数据库
    Request.QueryString 不能像使用方法那样使用不可调用
    将textbox中的光标移动到当前输入的文本后
    用户控件学习笔记
  • 原文地址:https://www.cnblogs.com/rickie/p/361309.html
Copyright © 2011-2022 走看看