日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

WebConfig的经典使用,大家一起交流一下吧!!!

發布時間:2025/7/25 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 WebConfig的经典使用,大家一起交流一下吧!!! 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Code
<?xml?version="1.0"?>
<!--?
????注意:?除了手動編輯此文件以外,您還可以使用?
????Web?管理工具來配置應用程序的設置。可以使用?Visual?Studio?中的
?????“網站”
->“Asp.Net?配置”選項。
????設置和注釋的完整列表在?
????machine.config.comments?中,該文件通常位于?
????\Windows\Microsoft.Net\Framework\v2.x\Config?中
-->
<configuration>
????
<configSections>
????????
<sectionGroup?name="system.web.extensions"?type="System.Web.Configuration.SystemWebExtensionsSectionGroup,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35">
????????????
<sectionGroup?name="scripting"?type="System.Web.Configuration.ScriptingSectionGroup,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35">
????????????????
<section?name="scriptResourceHandler"?type="System.Web.Configuration.ScriptingScriptResourceHandlerSection,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"?requirePermission="false"?allowDefinition="MachineToApplication"/>
????????????????
<sectionGroup?name="webServices"?type="System.Web.Configuration.ScriptingWebServicesSectionGroup,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35">
????????????????????
<section?name="jsonSerialization"?type="System.Web.Configuration.ScriptingJsonSerializationSection,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"?requirePermission="false"?allowDefinition="Everywhere"/>
????????????????????
<section?name="profileService"?type="System.Web.Configuration.ScriptingProfileServiceSection,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"?requirePermission="false"?allowDefinition="MachineToApplication"/>
????????????????????
<section?name="authenticationService"?type="System.Web.Configuration.ScriptingAuthenticationServiceSection,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"?requirePermission="false"?allowDefinition="MachineToApplication"/>
????????????????????
<section?name="roleService"?type="System.Web.Configuration.ScriptingRoleServiceSection,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"?requirePermission="false"?allowDefinition="MachineToApplication"/>
????????????????
</sectionGroup>
????????????
</sectionGroup>
????????
</sectionGroup>
????
</configSections>
????
<appSettings>
????????
<add?key="CRMonnection"?value="Data?Source=192.168.107.89;Initial?Catalog=CRM;Integrated?Security=false;uid=nouter;Password=123456"></add>
????????
<add?key="ForumName"?value="蘇飛"/>
????
</appSettings>
????
<connectionStrings/>
??
<!--意思是讓這個目錄給所有的用戶訪問-->
??
<location?path?="Error.aspx">
????
<system.web?>
??????
<authorization>
????????
<allow??users?="?"/>
??????
</authorization>
????
</system.web>
??
</location>
??
<!--意思是讓這個目錄給所有的用戶訪問-->
??
<location?path?="ErrorVal.aspx">
????
<system.web?>
??????
<authorization>
????????
<allow??users?="?"/>
??????
</authorization>
????
</system.web>
??
</location>
??
<!--意思是讓這個目錄給所有的用戶訪問-->
??
<location?path?="LoginImages">
????
<system.web?>
??????
<authorization>
????????
<allow??users?="?"/>
??????
</authorization>
????
</system.web>
??
</location>
??
<!--意思是讓這個目錄中指定的文件給所有的用戶訪問-->
??
<location?path?="SystemSetting/CheckCode.aspx">
????
<system.web?>
??????
<authorization>
????????
<allow??users?="?"/>
??????
</authorization>
????
</system.web>
??
</location>
????
<system.web>
????????
<!--?
????????????設置?compilation?debug
="true"?可將調試符號插入
????????????已編譯的頁面中。但由于這會?
????????????影響性能,因此只在開發過程中將此值?
????????????設置為?
true。
????????
-->
????????
<compilation?debug="true">
????????????
<assemblies>
????????????????
<add?assembly="System.Core,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=B77A5C561934E089"/>
????????????????
<add?assembly="System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????????
<add?assembly="System.Data.DataSetExtensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=B77A5C561934E089"/>
????????????????
<add?assembly="System.Xml.Linq,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=B77A5C561934E089"/>
????????????????
<add?assembly="Telerik.Charting,?Version=2.0.2.0,?Culture=neutral,?PublicKeyToken=D14F3DCC8E3E8763"/>
????????????????
<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"/></assemblies>
????????
</compilation>
????????
<!--
????????????通過?
<authentication>?節可以配置?ASP.NET?用來?
????????????識別進入用戶的
????????????安全身份驗證模式。?
????????
-->
????
<authentication??mode?="Forms"?>
??????
<forms?loginUrl="Login.aspx"??name?="login"></forms>
????
</authentication>
????
????
<authorization>
??????
<deny?users?="?"/>
??????
<allow??roles?="admin"/>
????
</authorization>
????
<!--
????????????如果在執行請求的過程中出現未處理的錯誤,
????????????則通過?
<customErrors>?節可以配置相應的處理步驟。具體說來,
????????????開發人員通過該節可以配置
????????????要顯示的?html?錯誤頁
????????????以代替錯誤堆棧跟蹤。

????????
<customErrors?mode="RemoteOnly"?defaultRedirect="GenericErrorPage.htm">
????????????
<error?statusCode="403"?redirect="NoAccess.htm"?/>
????????????
<error?statusCode="404"?redirect="FileNotFound.htm"?/>
????????
</customErrors>
????????
-->
????
<customErrors?mode="RemoteOnly"?defaultRedirect="Error.aspx">
??????
<error?statusCode="403"?redirect="Error.aspx"?/>
??????
<error?statusCode="404"?redirect="Error.aspx"?/>
????
</customErrors>
????
????
<!--??會話狀態設置
??????????默認情況下,ASP.NET?使用?Cookie?來標識哪些請求屬于特定的會話。
??????????如果?Cookie?不可用,則可以通過將會話標識符添加到?URL?來跟蹤會話。
?????????若要禁用?Cookie,請設置?sessionState?cookieless
="true"。
????
-->
????
<!--在這里設置為True是為了,驗證請求過濾,但是False表示沒有過濾這樣做太不安全了所以一定不要這樣,最好的方法是在當前頁面添加Page_Error()函數
????
???
protected?void?Page_Error(object?sender,?EventArgs?e)
????{
????????????Exception?ex?
=?Server.GetLastError();
????????????
if?(ex?is?HttpRequestValidationException)
????????????{
????????????????Response.Write(
"請您輸入合法字符串。");

????????????????Server.ClearError();?
//?如果不ClearError()這個異常會繼續傳到Application_Error()。
????????????}
????}
????
-->
????????
<pages?validateRequest?="true">
????????????
<controls>
????????????????
<add?tagPrefix="asp"?namespace="System.Web.UI"?assembly="System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????????
<add?tagPrefix="asp"?namespace="System.Web.UI.WebControls"?assembly="System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????
</controls>
????????
</pages>
????????
<httpHandlers>
????????????
<remove?verb="*"?path="*.asmx"/>
????????????
<add?verb="*"?path="*.asmx"?validate="false"?type="System.Web.Script.Services.ScriptHandlerFactory,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????
<add?verb="*"?path="*_AppService.axd"?validate="false"?type="System.Web.Script.Services.ScriptHandlerFactory,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????
<add?verb="GET,HEAD"?path="ScriptResource.axd"?type="System.Web.Handlers.ScriptResourceHandler,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"?validate="false"/>
????????
</httpHandlers>
????????
<httpModules>
????????????
<add?name="ScriptModule"?type="System.Web.Handlers.ScriptModule,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????
</httpModules>
????
</system.web>
????
<system.codedom>
????????
<compilers>
????????????
<compiler?language="c#;cs;csharp"?extension=".cs"?warningLevel="4"?type="Microsoft.CSharp.CSharpCodeProvider,?System,?Version=2.0.0.0,?Culture=neutral,?PublicKeyToken=b77a5c561934e089">
????????????????
<providerOption?name="CompilerVersion"?value="v3.5"/>
????????????????
<providerOption?name="WarnAsError"?value="false"/>
????????????
</compiler>
????????????
<compiler?language="vb;vbs;visualbasic;vbscript"?extension=".vb"?warningLevel="4"?type="Microsoft.VisualBasic.VBCodeProvider,?System,?Version=2.0.0.0,?Culture=neutral,?PublicKeyToken=b77a5c561934e089">
????????????????
<providerOption?name="CompilerVersion"?value="v3.5"/>
????????????????
<providerOption?name="OptionInfer"?value="true"/>
????????????????
<providerOption?name="WarnAsError"?value="false"/>
????????????
</compiler>
????????
</compilers>
????
</system.codedom>
????
<!--?
????????在?Internet?信息服務?
7.0?下運行?ASP.NET?AJAX?需要?system.webServer
????????節。對早期版本的?IIS?來說則不需要此節。
????
-->
????
<system.webServer>
????????
<validation?validateIntegratedModeConfiguration="false"/>
????????
<modules>
????????????
<remove?name="ScriptModule"/>
????????????
<add?name="ScriptModule"?preCondition="managedHandler"?type="System.Web.Handlers.ScriptModule,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????
</modules>
????????
<handlers>
????????????
<remove?name="WebServiceHandlerFactory-Integrated"/>
????????????
<remove?name="ScriptHandlerFactory"/>
????????????
<remove?name="ScriptHandlerFactoryAppServices"/>
????????????
<remove?name="ScriptResource"/>
????????????
<add?name="ScriptHandlerFactory"?verb="*"?path="*.asmx"?preCondition="integratedMode"?type="System.Web.Script.Services.ScriptHandlerFactory,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????
<add?name="ScriptHandlerFactoryAppServices"?verb="*"?path="*_AppService.axd"?preCondition="integratedMode"?type="System.Web.Script.Services.ScriptHandlerFactory,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????????
<add?name="ScriptResource"?preCondition="integratedMode"?verb="GET,HEAD"?path="ScriptResource.axd"?type="System.Web.Handlers.ScriptResourceHandler,?System.Web.Extensions,?Version=3.5.0.0,?Culture=neutral,?PublicKeyToken=31BF3856AD364E35"/>
????????
</handlers>
????
</system.webServer>
????
<runtime>
????????
<assemblyBinding?xmlns="urn:schemas-microsoft-com:asm.v1">
????????????
<dependentAssembly>
????????????????
<assemblyIdentity?name="System.Web.Extensions"?publicKeyToken="31bf3856ad364e35"/>
????????????????
<bindingRedirect?oldVersion="1.0.0.0-1.1.0.0"?newVersion="3.5.0.0"/>
????????????
</dependentAssembly>
????????????
<dependentAssembly>
????????????????
<assemblyIdentity?name="System.Web.Extensions.Design"?publicKeyToken="31bf3856ad364e35"/>
????????????????
<bindingRedirect?oldVersion="1.0.0.0-1.1.0.0"?newVersion="3.5.0.0"/>
????????????
</dependentAssembly>
????????
</assemblyBinding>
????
</runtime>
</configuration>

閱讀全文下載代碼:http://www.cckan.net/forum.php?mod=viewthread&tid=73

轉載于:https://www.cnblogs.com/sufei/archive/2009/05/16/1485979.html

總結

以上是生活随笔為你收集整理的WebConfig的经典使用,大家一起交流一下吧!!!的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。