日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

Webconfig-配置解析

 zww_blog 2016-09-13

來自csdn-goodspeed的文章,很詳細(xì),謝謝博主!  轉(zhuǎn)載過來分享給各位。

<?xml version="1.0"?>
<!--Webconfig的一般執(zhí)行順序:
1.當(dāng)前文件夾
2.父文件夾
3.Framework自定義的兩個config文件(web.config和machine.config)
注意:
子目錄的配置設(shè)置可以提供除從父目錄繼承的配置信息以外的配置信息,也可以重寫或修改父目錄中定義的設(shè)置。
運(yùn)行時對Web.config文件的修改不需要重啟服務(wù)就可以生效(注:<processModel> 節(jié)例外);
Web.config文件是可以擴(kuò)展的。你可以自定義新配置參數(shù)并編寫配置節(jié)處理程序以對它們進(jìn)行處理;
web.config配置文件(默認(rèn)的配置設(shè)置)以下所有的代碼都應(yīng)該位于<system.web></system.web>之間

-->
<configuration>
 <!--configuration 節(jié)根元素,其它節(jié)都是在它的內(nèi)部-->
 <!--配置節(jié)處理程序聲明 特點:位于配置文件的頂部,包含在<configSections>-->
 <!--自定義Web.config文件配置節(jié)過程分為兩步。
 1.在配置文件頂部 <configSections> 和 </configSections>標(biāo)記之間聲明配置節(jié)的名稱和處理該節(jié)中配置數(shù)據(jù)的 .NET Framework 類的名稱。
 2.是在 <configSections> 區(qū)域之后為聲明的節(jié)做實際的配置設(shè)置。
 -->
 <configSections>
  <section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
  <section name="ore.SiebelWrite" type="ORE.SiebelWrite.DataAccess.Bases.NetTiersServiceSection, ORE.SiebelWrite.DataAccess" allowDefinition="MachineToApplication" restartOnExternalChanges="true"/>
  <!--配置節(jié)組
  特點: 用用<sectionGroup>標(biāo)記,可以自定義分組,可以放到<configSections>內(nèi)部或其它<sectionGroup>標(biāo)記的內(nèi)部
  -->
  <sectionGroup name="ore">
   <section name="data" type="ORE.Framework.Providers.ProviderConfigurationHandler, ORE.Framework"/>
   <section name="scheduling" type="ORE.Framework.Providers.ProviderConfigurationHandler, ORE.Framework"/>
  </sectionGroup>
  <!--示例:創(chuàng)建一個節(jié)存儲數(shù)據(jù)庫連接字符串-->
  <section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
 </configSections>
 <enterpriseLibrary.ConfigurationSource selectedSource="File Configuration Source">
  <sources>
   <add name="File Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" filePath="entlib.config"/>
  </sources>
 </enterpriseLibrary.ConfigurationSource>
 <loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
  <listeners>
   <add databaseInstanceName="ORE" writeLogStoredProcName="WriteLog" addCategoryStoredProcName="AddCategory" formatter="Text Formatter" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Database Trace Listener"/>
  </listeners>
  <formatters>
   <add template="Timestamp: {timestamp}&#xA;Message: {message}&#xA;Category: {category}&#xA;Priority: {priority}&#xA;EventId: {eventid}&#xA;Severity: {severity}&#xA;Title:{title}&#xA;Machine: {machine}&#xA;Application Domain: {appDomain}&#xA;Process Id: {processId}&#xA;Process Name: {processName}&#xA;Win32 Thread Id: {win32ThreadId}&#xA;Thread Name: {threadName}&#xA;Extended Properties: {dictionary({key} - {value}&#xA;)}" type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Text Formatter"/>
  </formatters>
  <categorySources>
   <add switchValue="All" name="General">
    <listeners>
     <add name="Database Trace Listener"/>
    </listeners>
   </add>
  </categorySources>
  <specialSources>
   <allEvents switchValue="All" name="All Events"/>
   <notProcessed switchValue="All" name="Unprocessed Category"/>
   <errors switchValue="All" name="Logging Errors & Warnings">
    <listeners>
     <add name="Database Trace Listener"/>
    </listeners>
   </errors>
  </specialSources>
 </loggingConfiguration>
 <exceptionHandling>
  <exceptionPolicies>
   <add name="General Policy">
    <exceptionTypes>
     <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" postHandlingAction="NotifyRethrow" name="Exception">
      <exceptionHandlers>
       <add logCategory="General" eventId="91" severity="Error" title="Enterprise Library Exception Handling" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" name="Logging Handler"/>
      </exceptionHandlers>
     </add>
    </exceptionTypes>
   </add>
  </exceptionPolicies>
 </exceptionHandling>
 <connectionStrings>
  <!--<add name="ORE" connectionString="data source=TEST-SERVER-DATA;Integrated Security=SSPI;Database=SSET_US_P25;" providerName="System.Data.SqlClient"/>-->
  <add name="ORE" connectionString="data source=CARLO-PC;Integrated Security=SSPI;Database=SSET_US_P25;" providerName="System.Data.SqlClient"/>
 </connectionStrings> 
 <ore>
  <data defaultProvider="SqlDataProvider">
   <providers>
    <clear/>
    <add name="SqlDataProvider" type="ORE.Data.SqlDataProvider, ORE.SqlDataProvider" connectionStringName="ORE" upgradeConnectionString="" providerPath="~/Providers/DataProviders/SqlDataProvider/" objectQualifier="oq_" databaseOwner="dbo"/>
   </providers>
  </data>
  <scheduling defaultProvider="MSScheduler">
   <providers>
    <clear/>
    <add name="MSScheduler" type="ORE.Services.Scheduling.MSScheduling.MSScheduler, ORE.Services.Scheduling" providerPath="~/Providers/MSScheduler/" debug="false" maxThreads="1"/>
   </providers>
  </scheduling>
 </ore>
 <ore.SiebelWrite defaultProvider="SqlNetTiersProvider">
  <providers>
   <add name="SqlNetTiersProvider" type="ORE.SiebelWrite.DataAccess.SqlClient.SqlNetTiersProvider, ORE.SiebelWrite.DataAccess.SqlClient" connectionStringName="ORE" providerInvariantName="System.Data.SqlClient" entityFactoryType="ORE.SiebelWrite.Entities.EntityFactory" useEntityFactory="true" enableEntityTracking="true" enableMethodAuthorization="true" useStoredProcedure="false" defaultCommandTimeout="30"/>
  </providers>
 </ore.SiebelWrite>
 <appSettings><add key="scon" value="server=localhost;database=Northwind;uid=sa;pwd=123"/></appSettings>
 <!--訪問Web.config文件你可以通過使用ConfigurationSettings.AppSettings 靜態(tài)字符串集合來訪問 Web.config 文件示例
 protected static string Isdebug = ConfigurationManager.AppSettings["scon"]-->
 <appSettings>
  <!--appSettings此節(jié)用于定義應(yīng)用程序設(shè)置項。對一些不確定設(shè)置,還可以讓用戶根據(jù)自己實際情況自己設(shè)置-->
  <add key="Conntction" value="server=192.168.85.66;userid=sa;password=;database=Info;"/> <!--定義了一個連接字符串常量,并且在實際應(yīng)用時可以修改連接字符串,不用修改程式代碼-->.
  <add key="ErrPage" value="Error.aspx"/><!--定義了一個錯誤重定向頁面-->
  <!--<add key="SiebelUrl" value="https://swsiis2.parttest.extranettest.microsoft.com"/>-->
  <!--<add key="SiebelUrl" value="https://mssws.partners.extranet.microsoft.com"/>-->
  <add key="SiebelUrl" value="https://msswspreprod.partners.extranet.microsoft.com"/>
  <add key="ViewOppInSiebelLink" value="https://siebelpreprod.partners.extranet.microsoft.com/sales_enu/start.swe?SWECmd=GotoView&SWEView=Opportunity+List+View&SWERF=1&SWEBU=1&SWEApplet0=Opportunity+List+Applet&SWERowId0="/>
  <add key="ViewAccountInSiebelLink" value="https://siebelpreprod.partners.extranet.microsoft.com/sales_enu/start.swe?SWECmd=GotoView&SWEView=Account+List+View&SWERF=1&SWEBU=1&SWEApplet0=Account+List+Applet&SWERowId0="/>
  <add key="UsCustomerDocStore" value="http://usprofiling1:100/CustomerDocStore/default.aspx"/>
  <add key="Deployment" value="UAT"/>
  <add key="CutOffDate" value="2007/1/1"/>
  <add key="TestTeam" value="hoptjw.w-ojrps.w-{oofq.w-jmhopi.w-yzoobe.w-ymobut.w-pbhnbt.w-fitjz.w"/>
  <add key="Webserver" value="http://test-server-app:8020"/>
  <add key="applicationName" value="{0} Opportunity Resource Engine"/>
  <add key="applicationNameShort" value="{0} ORE"/>
  <add key="IntroFile" value="D:/inetpub/ORE SE/documents/Intro.htm"/>
  <add key="TestServer" value="True"/>
  <!--Switch to specify whether an admin user should be notified about unhandled exceptions via email (true/false)-->
  <add key="enableErrorNotification" value="true"/>
  <!--Email addresses used for error notification-->
  <add key="errorMessageFromEmailAddress" value="SSET US<sset@microsoft.com>"/>
  <!--The email address(es) to appear in the To field. Separate with semicolons.-->
  <add key="errorMessageToEmailAddresses" value="i-paalex@microsoft.com"/>
  <!--Specifies the BCC address(es) for new opportunity requests (if any).If specifiying multiple addresses, separate with semicolons.-->
  <add key="newRequestBCCEmailAddresses" value=""/>
  <!--The default site coordinator details.These details will be used if a coordinator hasn't been selected from the list of Specialists.-->
  <add key="defaultCoordinatorName" value="ORE Helpdesk"/>
  <add key="defaultCoordinatorAlias" value="Help4US"/>
  <add key="NotifierEmailAddress" value="ore@microsoft.com"/>
  <!--Siebel location search filter-->
  <add key="swsMSLocationFilter" value="United States"/>
  <!--Specifies whether wildcards (*) are implicit in the Siebel Search (true/false)-->
  <add key="useImplicitWildcards" value="False"/>
  <!--If using implicit wildcards, specifies whether to prepend the wildcard to the search criterion (true/false)-->
  <add key="addLeadingWildcard" value="False"/>
  <!--Specifies whether to raise an error if the search returns 100 results (true/false)-->
  <add key="raiseErrorIfExcessResults" value="True"/>
  <!-- Specifies the default number of days to add to todays date in order to calulate the Request Due Date for a new request-->
  <add key="defaultDueDateDaysToAdd" value="7"/>
  <!-- Specifies the SMTP Server to use when sending emails-->
  <add key="smtpServer" value="smtphost.redmond.corp.microsoft.com"/>
  <!--The following key defines the list of acceptable character codes that should NOT be encoded by the IOSec.HtmlEncode method-->
  <add key="allowedCharacterCodes" value="148,153,132,142,129,154,225,33,35,36,37,38,40,41,43,44,45,46,47,58,59,61,63,92,8211"/>
  <!-- Database Settings for Siebel Upload-->
  <add key="DatabaseServerUpload" value="test-server-data"/>
  <add key="DatabaseCatalogUpload" value="SSET_US_P25"/>
  <add key="DatabasePersistSecurityInfoUpload" value="false"/>
  <!-- Version: Dev | Live | Config -->
  <add key="Version" value="Dev"/>
  <add key="NotificationFilter" value="pi{id.w-jfm{.w-ofitz.w-vidze.w-fitjz.w-hoptjw.w-ymobut.w-ojrps.w-{oofq.w-pbhfm.w-jmhopi.w-yzoobe.w"/>
  <add key="LocalPort" value="10079"/>
  <add key="RemotePort" value="10086"/>
  <add key="AppointmentPage" value="CreateAppointment.aspx"/>
 </appSettings>


 <!--<system.Web>節(jié),控制asp.net運(yùn)行時的行為-->
 <system.web>
  <httpHandlers>
   <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
  </httpHandlers>
  <pages validateRequest="false" enableViewStateMac="true" enableEventValidation="false">
   <controls>
    <add tagPrefix="data" namespace="ORE.SiebelWrite.Web.Data" assembly="ORE.SiebelWrite.Web"/>
    <add tagPrefix="data" namespace="ORE.SiebelWrite.Web.UI" assembly="ORE.SiebelWrite.Web"/>
   </controls>
  </pages>
  
  <httpModules>
   <add name="SiebelWriteEntityTransactionModule" type="ORE.SiebelWrite.Web.Data.EntityTransactionModule"/>
  </httpModules>

  <!--<compilation>節(jié)作用:配置 asp.NET 使用的所有編譯設(shè)置。默認(rèn)的debug屬性為“True”.在程序編譯完成交付使用之后應(yīng)將其設(shè)為False-->
  <compilation debug="true" defaultLanguage="c#">
   <!--default language: 定義后臺代碼語言,可以選擇c#和vb.net兩種語言
    debug : 為true時,啟動aspx調(diào)試;為false不啟動aspx調(diào)試,因而可以提高應(yīng)用程序運(yùn)行時的性能。一般程序員在開發(fā)時設(shè)置為true,交給客戶時設(shè)置為false.
   -->
   <assemblies>
    <add assembly="System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Xceed.Compression.Formats, Version=1.0.5357.0, Culture=neutral, PublicKeyToken=BA83FF368B7563C6"/>
    <add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="Xceed.Compression, Version=2.3.5357.0, Culture=neutral, PublicKeyToken=BA83FF368B7563C6"/>
    <add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="Microsoft.ApplicationBlocks.Data, Version=1.8.0.0, Culture=neutral, PublicKeyToken=BB47406E8B145095"/>
    <add assembly="Microsoft.Web.Services2, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Configuration.Install, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Security, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.ServiceProcess, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="MS.Alchemy.CommonPlatform, Version=1.8.0.0, Culture=neutral, PublicKeyToken=BB47406E8B145095"/>
    <add assembly="MS.Alchemy.Core, Version=1.8.0.0, Culture=neutral, PublicKeyToken=BB47406E8B145095"/>
    <add assembly="MS.Alchemy.GlobalStore, Version=1.8.0.0, Culture=neutral, PublicKeyToken=BB47406E8B145095"/>
    <add assembly="MS.Alchemy.LocalStore, Version=1.8.0.0, Culture=neutral, PublicKeyToken=BB47406E8B145095"/>
    <add assembly="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
   </assemblies>
   <buildProviders>
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
   </buildProviders>
  </compilation>
  

  <!--mode : 具有On,Off,RemoteOnly 3種狀態(tài)。On表示始終顯示自定義的信息; Off表示始終顯示詳細(xì)的asp.net錯誤信息; RemoteOnly表示只對不在本地Web服務(wù)器上運(yùn)行的用戶顯示自定義信息.-->
  <!--<customErrors> 為 asp.NET 應(yīng)用程序提供有關(guān)自定義錯誤信息的信息。它不適用于 xml Web services 中發(fā)生的錯誤。-->
  <customErrors mode="RemoteOnly" defaultRedirect="Error.aspx">
   <error statusCode="440" redirect="err440.aspx"/>
   <error statusCode="550" redirect="err550.aspx"/>
  </customErrors>
  
  <!--authentication作用:配置 asp.NET 身份驗證支持(為Windows、Forms、PassPort、None四種)。該元素只能在計算機(jī)、站點或應(yīng)用程序級別聲明。< authentication> 元素必需與<authorization> 節(jié)配合使用。-->
  <!--<authentication mode="Windows"/>-->
  <!--Windows: 使用IIS驗證方式
  Forms: 使用基于窗體的驗證方式
  Passport: 采用Passport cookie驗證模式
  None: 不采用任何驗證方式-->
  <authentication mode="Forms">
   <forms name=".ASPUSERDEMO" loginUrl="Login.aspx" protection="All" timeout="30" />
  </authentication>
  <!--.Name: 指定完成身份驗證的Http cookie的名稱.
  LoginUrl: 如果未通過驗證或超時后重定向的頁面URL,一般為登錄頁面,讓用戶重新登錄
  Protection: 指定 cookie數(shù)據(jù)的保護(hù)方式.
    可設(shè)置為: All None Encryption Validation四種保護(hù)方式
    a. All表示加密數(shù)據(jù),并進(jìn)行有效性驗證兩種方式
    b. None表示不保護(hù)Cookie.
    c. Encryption表示對Cookie內(nèi)容進(jìn)行加密
    d. validation表示對Cookie內(nèi)容進(jìn)行有效性驗證
  TimeOut: 指定Cookie的失效時間. 超時后要重新登錄.-->
  <!--<authorization> 節(jié)
   作用:控制對 URL 資源的客戶端訪問(如允許匿名用戶訪問)。此元素可以在任何級別(計算機(jī)、站點、應(yīng)用程序、子目錄或頁)上聲明。必需與<authentication> 節(jié)配合使用。
   示例:以下示例禁止匿名用戶的訪問
   注:你可以使用user.identity.name來獲取已經(jīng)過驗證的當(dāng)前的用戶名;
   可以使用web.Security.FormsAuthentication.RedirectFromLoginPage方法將已驗證的用戶重定向到用戶剛才請求的頁面
  -->
  <authorization>
   <deny users="?"/>
  </authorization>
  <!--asp.net 關(guān)于form認(rèn)證的一般設(shè)置:
  1: 在web.config中,加入form認(rèn)證;
     <authentication mode="Forms">
     <forms name="auth" loginUrl="index.aspx" timeout="30"></forms>
  </authentication>
  <authorization>
    <deny users="?" />
   </authorization>
  2: 如果有注冊頁面時還應(yīng)該允許匿名用戶調(diào)用注冊頁面進(jìn)行注冊;
  以下代碼應(yīng)該在<configuration><system.web>之間,而不應(yīng)該包含到<system.web>..</system.web>之間;
  ----------------表示允許匿名用戶對 userReg.aspx頁面進(jìn)行訪問.
   <location path="userReg.aspx">
   <system.web>
    <authorization>
     <allow users="?" />
    </authorization>
   </system.web>
  </location>
  3 在登錄成功后要創(chuàng)建身份驗證票, 表明已經(jīng)通過認(rèn)證的合法用戶;
  if(登陸成功)
  System.Web.Security.FormsAuthentication.SetAuthCookie(用戶名稱, false);-->

  <!--<identity impersonate="true" userName="registry:HKLM/SOFTWARE/ORE/identity/ASPNET_SETREG,userName" password="registry:HKLM/SOFTWARE/ORE/identity/ASPNET_SETREG,password"/>-->
  <!--<identity impersonate="true" userName="REDMOND/OREPP" password="@ct@BER_3RD"/>-->
  <identity impersonate="true" userName="REDMOND/OREPP" password="nOvbEr_igtH"/>

  <!--<trace> 配置 asp.NET 跟蹤服務(wù),主要用來程序測試判斷哪里出錯。
  示例:以下為Web.config中的默認(rèn)配置:
  注:
  enabled="false"表示不啟用跟蹤;
  requestLimit="10"表示指定在服務(wù)器上存儲的跟蹤請求的數(shù)目
  pageOutput="false"表示只能通過跟蹤實用工具訪問跟蹤輸出;
  traceMode="SortByTime"表示以處理跟蹤的順序來顯示跟蹤信息
  localOnly="true" 表示跟蹤查看器 (trace.axd) 只用于宿主 Web 服務(wù)器
  -->
  <trace enabled="false" requestLimit="10" pageOutput="true" traceMode="SortByTime" localOnly="true"/>


  <!--<sessionState> 為當(dāng)前應(yīng)用程序配置會話狀態(tài)設(shè)置(如設(shè)置是否啟用會話狀態(tài),會話狀態(tài)保存位置)。-->
  <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;user id=sa;password=" cookieless="false" timeout="1440" />
  <!--<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI" cookieless="false" timeout="1440"/>-->
  <!--.mode: 分為off,Inproc,StateServer,SqlServer幾種狀態(tài)
  mode = InProc 存儲在進(jìn)程中特點:具有最佳的性能,速度最快,但不能跨多臺服務(wù)器存儲共享.
  mode = "StateServer" 存儲在狀態(tài)服務(wù)器中特點:   當(dāng)需要跨服務(wù)器維護(hù)用戶會話信息時,使用此方法。但是信息存儲在狀態(tài)服務(wù)器上,一旦狀態(tài)服務(wù)器出現(xiàn)故障,信息將丟失
  mode="SqlServer" 存儲在sql server中特點:工作負(fù)載會變大,但信息不會丟失.
  
  stateConnectionString : 設(shè)置將session信息存儲在狀態(tài)服務(wù)中時使用的服務(wù)器名稱和端口號,默認(rèn)是本機(jī),當(dāng)mode的值是StateServer是,這個屬性是必需的。例如:"tcpip=127.0.0.1:42424”。
  sqlConnectionString:設(shè)置與sql server連接時的連接字符串。例如"data source= localhost;Integrated Security=SSPI;Initial Catalog=northwind"。當(dāng)mode的值是 SQLServer時,這個屬性是必需的
  Cookieless:設(shè)置為true時,表示不使用cookie會話狀態(tài)來標(biāo)識客戶;否則,相反.
  TimeOut:用來定義會話狀態(tài)存儲的時間,超過期限,將自動終止會話.-->
  <!--asp.NET中客戶端session狀態(tài)的存儲
  常有的session模型中,session狀態(tài)應(yīng)該存儲在兩個地方,分別是客戶端和服務(wù)器端。客戶端只負(fù)責(zé)保存相應(yīng)網(wǎng)站的SessionID,而其他的session信息則保存在服務(wù)器端。
  在asp中,客戶端的SessionID實際是以Cookie的形式存儲的。如果用戶在瀏覽器的設(shè)置中選擇了禁用Cookie,那末他也就無法享受session的便利之處了,甚至造成不能訪問某些網(wǎng)站。
  為了解決以上問題,在 asp.NET中客戶端的session信息存儲方式分為:Cookie和Cookieless兩種。
  asp.NET中,默認(rèn)狀態(tài)下,在客戶端還是使用Cookie存儲session信息的。如果我們想在客戶端使用Cookieless的方式存儲session信息的方法如下:
  找到當(dāng)前Web應(yīng)用程序的根目錄,將cookieless="false"改為:cookieless="true",這樣,客戶端的session信息就不再使用 Cookie存儲了,而是將其通過URL存儲。
  重新訪問Web應(yīng)用程序,就會看到類似下面的樣子:其中,http://localhost/MyTestApplication/(ulqsek45heu3ic2a5zgdl245) /default.aspx中黑體標(biāo)出的就是客戶端的session ID。
  注意,這段信息是由IIS自動加上的,不會影響以前正常的連接。-->

  <!--
當(dāng)mode的值是InProc時,說明服務(wù)器正在使用這種模式。
這種方式和以前asp中的模式一樣,就是服務(wù)器將session信息存儲在IIS進(jìn)程中。當(dāng)IIS關(guān)閉、重起后,這些信息都會丟失。但是這種模式也有自己最大好處,就是性能最高。應(yīng)為所有的session信息都存儲在了IIS的進(jìn)程中,所以IIS能夠很快的訪問到這些信息,這種模式的性能比進(jìn)程外存儲session信息或是在sql server中存儲session信息都要快上很多。這種模式也是asp.NET的默認(rèn)方式。

將服務(wù)器session信息存儲在進(jìn)程外
(1)打開管理工具->服務(wù),找到名為:asp.NET State Service的服務(wù),啟動它。實際上,這個服務(wù)就是啟動一個要保存session信息的進(jìn)程。啟動這個服務(wù)后,你可以從Windows任務(wù)管理器->進(jìn)程中看到一個名為 aspnet_state.exe的進(jìn)程,這個就是我們保存session信息的進(jìn)程。
(2)將mode的值改為StateServer。
  實際上,這種將session信息存儲在進(jìn)程外的方式不光指可以將信息存儲在本機(jī)的進(jìn)程外,還可以將session信息存儲在其他的服務(wù)器的進(jìn)程中。這時,不光需要將mode的值改為StateServer,還需要在stateConnectionString中配置相應(yīng)的參數(shù)。例如你的計算你是192.168.0.1,你想把session存儲在ip為192.168.0.2的計算機(jī)的進(jìn)程中,就需要設(shè)置成這樣: stateConnectionString="tcpip=192.168.0.2:42424"。當(dāng)然,不要忘記在192.168.0.2的計算機(jī)中裝上.NET Framework,并且啟動asp.NET State Services服務(wù)。

將服務(wù)器session信息存儲在sql server中
(1)啟動sql server和sql server代理服務(wù)。在sql server中執(zhí)行一個叫做 InstallSqlState.sql的腳本文件。這個腳本文件將在sql server中創(chuàng)建一個用來專門存儲session信息的數(shù)據(jù)庫,及一個維護(hù)session信息數(shù)據(jù)庫的sql server代理作業(yè)。
可以在以下路徑中找到那個文件:
[system drive]/winnt/Microsoft.NET/Framework/[version]/ 
(2)打開查詢分析器,連接到sql server服務(wù)器,打開剛才的那個文件并且執(zhí)行。稍等片刻,數(shù)據(jù)庫及作業(yè)就建立好了。這時,可以打開企業(yè)管理器,看到新增了一個叫ASPState的數(shù)據(jù)庫。但是這個數(shù)據(jù)庫中只是些存儲過程,沒有用戶表。實際上session信息是存儲在了tempdb 數(shù)據(jù)庫的ASPStateTempSessions表中的,另外一個ASPStateTempApplications表存儲了asp中 application對象信息。這兩個表也是剛才的那個腳本建立的。另外查看管理->SQL server代理->作業(yè),發(fā)現(xiàn)也多了一個叫做ASPState_Job_DeleteExpiredSessions的作業(yè),這個作業(yè)實際上就是每分鐘去ASPStateTempSessions 表中刪除過期的session信息的。
  接著,我們返回到Web.config文件,修改mode的值改為SQLServer。注意,還要同時修改sqlConnectionString的值,格式為:sqlConnectionString="data source=localhost; Integrated Security=SSPI;"
  其中data source是指sql server服務(wù)器的ip地址,如果sql server與IIS是一臺機(jī)子,寫127.0.0.1 就行了。Integrated Security=SSPI的意思是使用Windows集成身份驗證,這樣,訪問數(shù)據(jù)庫將以asp.NET的身份進(jìn)行,通過如此配置,能夠獲得比使用sql server驗證方式更好的安全性。當(dāng)然,如果sql server運(yùn)行于另一臺計算機(jī)上,你可能會需要通過Active Directory域的方式來維護(hù)兩邊驗證的一致性。
-->

  <globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US"/>
  <!--requestEncoding: 它用來檢查每一個發(fā)來請求的編碼,responseEncoding: 用于檢查發(fā)回的響應(yīng)內(nèi)容編碼,fileEncoding: 用于檢查aspx,asax等文件解析的默認(rèn)編碼-->

  <!--<webServices>
   <soapExtensionTypes>
    <add type="Microsoft.Web.Services2.WebServicesExtension, Microsoft.Web.Services2, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="1" group="0"/>
   </soapExtensionTypes>
  </webServices>-->
  
  <!--<httpRuntime>配置 asp.NET HTTP 運(yùn)行庫設(shè)置。該節(jié)可以在計算機(jī)、站點、應(yīng)用程序和子目錄級別聲明。-->
  <!--Eg:控制用戶上傳文件最大為4M,最長時間為60秒,最多請求數(shù)為100-->
  <httpRuntime maxRequestLength="4000" executionTimeout="60" appRequestQueueLimit="100"/>
  <!--<httpRuntime executionTimeout="36000" useFullyQualifiedRedirectUrl="true" maxRequestLength="81920"/>-->

  <!--<pages> 標(biāo)識特定于頁的配置設(shè)置(如是否啟用會話狀態(tài)、視圖狀態(tài),是否檢測用戶的輸入等)。可以在計算機(jī)、站點、應(yīng)用程序和子目錄級別聲明。-->
  <!--示例:不檢測用戶在瀏覽器輸入的內(nèi)容中是否存在潛在的危險數(shù)據(jù)(注:該項默認(rèn)是檢測,如果你使用了不檢測,一定要對用戶的輸入進(jìn)行編碼或驗證),在從客戶端回發(fā)頁時將檢查加密的視圖狀態(tài),以驗證視圖狀態(tài)是否已在客戶端被篡改。(注:該項默認(rèn)是不驗證)-->
  <pages validateRequest="false" buffer="true" enableViewStateMac="true" />
 </system.web>

 <!--特定應(yīng)用程序配置 特點: 位于<appSetting>,可以定義應(yīng)用程序的全局常量設(shè)置等信息-->

 

 <system.runtime.remoting>
  <application>
   <client>
    <wellknown type="ClientStore, LocalTransactionStore" url="http://localhost:8000/ClientStore.rem"/>
   </client>
   <channels>
    <channel ref="http" port="0">
     <clientProviders>
      <formatter ref="binary"/>
     </clientProviders>
    </channel>
   </channels>
  </application>
 </system.runtime.remoting>
 <!--UAT-->
 <ms.alchemy.commonplatform>
  <runtime directory="C:/Program Files/Microsoft Alchemy/Common Platform 1.8/metadata" stsprimary="ACPSTS.partners.extranet.microsoft.com" autodelegate="true" clientname="6E8D3B96-5616-4899-834F-E26ED15F1A33" hostname="" instrumentationlevel="0" minimumcompressionpercent="10" maxdatasize="4000" mode="Native" proxyprocessor="Required" stssecondary="" tracelevel="5" transactionloglevel="Request|Response" ltsmachine="localhost" ltsport="8000" ltsmode="Remoting" serverprocessor="Required"/>
  <cache transactions="120" consumer="36000" user="36000" entity="36000" config="30"/>
  <lts frequency="60" tracing="On" gtsmachine="ACPGTS.partners.extranet.microsoft.com" gtsport="8989" samplerate="1" exceedfrequency="25" maxworkingset="35000"/>
 </ms.alchemy.commonplatform>
 <!--TEST-->
 <!--<ms.alchemy.commonplatform>
  <runtime directory="C:/Program Files/Microsoft Alchemy/Common Platform 1.8/metadata" stsprimary="juacpqa.parttest.extranettest.microsoft.com" autodelegate="true" clientname="oretsa_dec19test2" hostname="" instrumentationlevel="0" minimumcompressionpercent="10" maxdatasize="4000" mode="Native" proxyprocessor="Required" stssecondary="" tracelevel="5" transactionloglevel="Request|Response" ltsmachine="localhost" ltsport="8000" ltsmode="Remoting" serverprocessor="Required"/>
  <cache transactions="120" consumer="36000" user="36000" entity="36000" config="30"/>
  <lts frequency="60" tracing="On" gtsmachine="juacpqa.parttest.extranettest.microsoft.com" gtsport="8989" samplerate="1" exceedfrequency="25" maxworkingset="35000"/>
 </ms.alchemy.commonplatform>-->
 <!--PRODUCTION-->
 <!--<ms.alchemy.commonplatform>
  <runtime directory="C:/Program Files/Microsoft Alchemy/Common Platform 1.8/metadata" stsprimary="ACPSTS.partners.extranet.microsoft.com" autodelegate="true" clientname="09FCF9C4-546F-43C5-B1A2-4FE77A8BD0DC" hostname="" instrumentationlevel="0" minimumcompressionpercent="10" maxdatasize="4000" mode="Native" proxyprocessor="Required" stssecondary="" tracelevel="5" transactionloglevel="Request|Response" ltsmachine="localhost" ltsport="8000" ltsmode="Remoting" serverprocessor="Required"/>
  <cache transactions="120" consumer="36000" user="36000" entity="36000" config="30"/>
  <lts frequency="60" tracing="On" gtsmachine="ACPGTS.partners.extranet.microsoft.com" gtsport="8989" samplerate="1" exceedfrequency="25" maxworkingset="35000"/>
 </ms.alchemy.commonplatform>-->
</configuration>

    本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多