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

     

  • 相关阅读:
    需要登陆网站后才能获取数据的页面爬取
    PTA中提交Python3程序的一些套路
    PAT 甲级 1014 Waiting in Line (30 分)(queue的使用,模拟题,有个大坑)
    PAT 甲级 1013 Battle Over Cities (25 分)(图的遍历,统计强连通分量个数,bfs,一遍就ac啦)
    PAT 甲级 1012 The Best Rank (25 分)(结构体排序)
    anconda + python 3.6安装(以前的anconda,anaconda和python版本对应关系)
    数学建模python matlab 编程(喷泉模拟)
    数学建模python matlab 编程(疾病传播模型)
    scikit-learn机器学习(四)使用决策树做分类,并画出决策树,随机森林对比
    scikit-learn机器学习(四)使用决策树做分类
  • 原文地址:https://www.cnblogs.com/rickie/p/361309.html
Copyright © 2011-2022 走看看