首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> ASP.NET 基礎 >> ASP.NET 基礎

Coolite (Ext.NET) 專案完整設定指南:Web.config、工具箱、版本對應、官方範本

     編輯:ASP.NET 基礎

什麼是 Coolite?

Coolite Toolkit 是 Ext JS 的 ASP.NET 伺服器端封裝,後更名為 Ext.NET。本文針對 Coolite 0.8.2 (2009) 版本整理設定步驟,適用於維護舊專案;新專案建議直接使用 Ext.NET 7+ (.NET Core/.NET 6+)。

1. 下載與參考

  • 官網:https://www.coolite.com/download/ (已轉向 Ext.NET)。
  • 專案加入參考:Coolite.Ext.Web.dll、Coolite.Utilities.dll。

2. Web.config 完整設定 (關鍵區段標註)


<configSections>
  <section name="coolite" type="Coolite.Ext.Web.GlobalConfig" requirePermission="false" />
  <!-- ASP.NET AJAX 區段 (必要) -->
</configSections>

<coolite theme="Default" /> <!-- 全域主題:Default/Gray/Slate -->

<system.web>
  <httpHandlers>
    <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
    <!-- ASP.NET AJAX handlers -->
  </httpHandlers>
  <httpModules>
    <add name="AjaxRequestModule" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
    <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions" />
  </httpModules>
  <pages>
    <controls>
      <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions" />
      <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions" />
    </controls>
  </pages>
</system.web>

<system.webServer> <!-- IIS 7+ 整合模式 -->
  <validation validateIntegratedModeConfiguration="false" />
  <modules>
    <remove name="ScriptModule" />
    <add name="AjaxRequestModule" preCondition="managedHandler" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
    <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions" />
  </modules>
  <handlers>
    <remove name="WebServiceHandlerFactory-Integrated" />
    <remove name="ScriptHandlerFactory" />
    <remove name="ScriptHandlerFactoryAppServices" />
    <remove name="ScriptResource" />
    <add name="AjaxRequestHandler" verb="*" path="*/coolite.axd" preCondition="integratedMode" type="Coolite.Ext.Web.ResourceManager" />
    <!-- ASP.NET AJAX handlers -->
  </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>
  </assemblyBinding>
</runtime>

3. Visual Studio 工具箱安裝

  1. 工具箱右鍵 → 「新增索引標籤」 → 命名 "Coolite Toolkit"。
  2. 在新索引標籤右鍵 → 「選擇項目」 → 「.NET Framework 元件」 → 「瀏覽」 → 選取 Coolite.Ext.Web.dll。
  3. 確認元件出現在列表並勾選,按確定即可拖曳使用。

4. GlobalConfig 可用屬性 (coolite 區段)

5. 官方範本 Web.config 精簡版


<configuration>
  <configSections>
    <section name="coolite" type="Coolite.Ext.Web.GlobalConfig" requirePermission="false" />
  </configSections>
  <coolite theme="Default" />
  <system.web>
    <httpHandlers>
      <add path="*/coolite.axd" verb="*" type="Coolite.Ext.Web.ResourceManager" validate="false" />
    </httpHandlers>
    <httpModules>
      <add name="AjaxRequestModule" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
    </httpModules>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules>
      <add name="AjaxRequestModule" preCondition="managedHandler" type="Coolite.Ext.Web.AjaxRequestModule, Coolite.Ext.Web" />
    </modules>
    <handlers>
      <add name="AjaxRequestHandler" verb="*" path="*/coolite.axd" preCondition="integratedMode" type="Coolite.Ext.Web.ResourceManager" />
    </handlers>
  </system.webServer>
</configuration>

6. 遷移至 Ext.NET 現代版本建議

  • NuGet:Install-Package Ext.NET (v7+ 支援 .NET 6/7/8)。
  • Web.config 由 Ext.NET 自動注入 (透過 WebActivator),無需手動編輯。
  • 命名空間變更:Coolite.Ext.Web → Ext.Net。
  • 控制項標籤前綴:<ext:Button> 維持相似。
  • JavaScript 端從 Ext JS 3/4 升級至 Ext JS 7 (Modern/Classic toolkit)。

授權注意

  • Coolite 0.8.2 為 Community Edition (LGPL),允許商業使用但需開源修改部分。
  • Ext.NET 5+ 採用商業授權 (GPL v3 或商業授權),專案若不開源需購買授權。
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved
屬性預設值說明
themeDefaultDefault / Gray / Slate
scriptAdapterExtExt / jQuery / Prototype / YUI
renderScriptsEmbeddedEmbedded / File / None
renderStylesEmbeddedEmbedded / File / None
gziptrue壓縮腳本/樣式輸出
cleanResourceUrltrue美化 WebResource.axd 網址
ajaxViewStateModeExcludeExclude / Include / Default
stateProviderPostBackPostBack / Cookie / None
quickTipstrue啟用 Ext QuickTips