2025年4月10日 星期四

[研究]Microsoft PerfView and TraceEvent 3.1.20 效能與事件分析工具

[研究]Microsoft PerfView and TraceEvent 3.1.20 效能與事件分析工具

2025-04-10

PerfView 是一個由微軟開發的 效能分析工具(Performance Analyzer)。

TraceEvent 是由 Microsoft 推出的 .NET 程式庫(Library),專門用來 讀取、分析 ETW 事件資料。PerfView 其實就是使用 TraceEvent 這個 library 所建構的。

Microsoft PerfView and TraceEvent 3.1.20 於 2025-04-01 釋出。

下載 PerfView.exe
https://github.com/Microsoft/perfview/blob/main/documentation/Downloading.md
https://github.com/Microsoft/perfview/releases

PerfView 教學課程
https://learn.microsoft.com/zh-tw/shows/perfview-tutorial/

使用 PerfView 收集 ETL 追蹤,並使用所有呼叫堆疊建立迷你傾印
https://learn.microsoft.com/zh-tw/visualstudio/ide/report-a-problem-perfview-minidumps



有空再繼續研究、、、

(待續)

[研究]Visual Studio診斷工具 (Visual Studio Diagnostic Tools)

[研究]Visual Studio診斷工具 (Visual Studio Diagnostic Tools)

2025-04-10

Visual Studio Diagnostic Tools(Visual Studio 2019 內建)



有空再多花時間研究、、、

(待續)

[研究]微軟 DebugDiag v2 Update 3.2 故障診斷與分析工具

[研究]Microsoft DebugDiag(Debug Diagnostics Tool v2 Update 3.2) 故障診斷與分析工具

2025-04-10

官方下載 DebugDiagx64.msi
https://www.microsoft.com/en-us/download/details.aspx?id=103453

DebugDiag(Debug Diagnostics Tool,微軟出品)主要用途 ? 特色 ?

ChatGPT 說:

DebugDiag(全名:Debug Diagnostics Tool)是微軟推出的一款故障診斷與分析工具,主要針對 Windows 系統中的應用程式故障(如崩潰、記憶體洩漏、CPU 高占用) 進行偵錯與問題分析。這套工具對於系統管理員、IT 支援人員,以及需要診斷複雜應用錯誤的開發者來說特別實用。

主要用途:

  • 應用程式崩潰(Crash)分析
    • 收集崩潰當下的記憶體傾印檔(Dump)
    • 分析錯誤原因,例如哪個模組造成存取違規、例外等
  • 記憶體洩漏(Memory Leak)診斷
    • 追蹤進程中記憶體分配情形
    • 偵測長時間運行下記憶體是否持續上升
  • 高 CPU 使用率問題分析
    • 收集 CPU 使用率異常時的執行緒堆疊
    • 找出造成占用的模組與方法(例如無限迴圈)
  • 應用程式掛起(Hang)分析
    • 比如 IIS 網站卡住無法回應時
    • 查看主執行緒卡在哪個函式、是否死鎖等
  • 支援 IIS / COM+ / 自訂應用程式診斷
    • 對 ASP.NET、IIS、COM+ 應用有內建偵錯支援

    特色與優點:

    •  圖形化介面(GUI):提供清楚的 GUI 操作介面,不需要寫命令列,容易上手
    •  Rule-based 設定:可針對特定進程、事件(如崩潰、異常)自動啟動記憶體傾印
    • 內建分析工具:可分析記憶體 Dump 並產生詳細的 HTML 分析報告
    • 與 IIS 整合:對 IIS 應用崩潰/記憶體問題特別有效
    • 支援腳本自動化:可使用 VBScript / JavaScript 撰寫分析規則或擴充功能
    • 報告可讀性高:分析報告清楚指出呼叫堆疊、模組、異常原因,並有建議解決方式

    適用情境舉例:

    • IIS 網站常當機但 event log 沒明確線索
    • 長期執行的 .NET 應用程式記憶體不斷上升
    • 某系統間歇性無回應、CPU 爆高但找不到原因
    • 想針對特定錯誤類型自動收集 dump 分析

    【下載、安裝】











    看來功能不少,使用要花時間研究、、、

    (待續)

    [研究]ASP.NET,System.OutOfMemoryException 的 Memory 指的是甚麼特殊區塊的記憶體?

    [研究]ASP.NET,System.OutOfMemoryException 的 Memory 指的是甚麼特殊區塊的記憶體?

    2025-04-10

    環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

    ********************************************************************************


    看到 System.OutOfMemoryException 訊息時,「工作管理員」顯示16 GB被用了 9.4 GB,RAM 並沒有真正被用盡,請問 System.OutOfMemoryException 的 Memory 指的是甚麼特殊區塊的記憶體 ?

    ChatGPT 說:

    這個問題非常好,而且很多開發者初期都會被「工作管理員只用了 9.4 GB / 16 GB,為什麼還報 OutOfMemoryException?」這件事搞混。這其實牽涉到 .NET 運作的記憶體模型,而 System.OutOfMemoryException 所指的並不等於「整台機器的實體記憶體用完了」,而是以下幾種更細緻的原因。

    一、OutOfMemoryException 真正的意思

    它的實際意義是:.NET 執行環境無法配置所需的記憶體區塊。

    也就是說,即使系統還有可用的實體記憶體,只要 .NET runtime 無法找到一個連續的足夠大記憶體區塊,它也會拋出這個例外。

    二、造成 OutOfMemoryException 的常見原因(即使 RAM 還沒爆)

    1. Large Object Heap (LOH) 碎裂 / 空間不足

    • LOH 會儲存超過 85,000 bytes(約 83 KB) 的物件(例如大陣列、字串、圖像等)。
    • 如果你的應用程式不斷配置/釋放大物件,而又沒有適時 compact,就會造成 記憶體碎裂(fragmentation)。
    • 雖然總 RAM 看起來還很夠,但無法找到「連續的空間」,就會拋出 OutOfMemoryException。

    2. 32-bit 應用程式限制(最多使用約 2GB 虛擬記憶體)

    • 如果你的 ASP.NET 應用程式是在 32-bit 模式下執行,不管你有多少 RAM,它最多只能用約 2GB 的虛擬記憶體。
    • 這是最常見的原因之一。
    • 可改設定 IIS 應用程式池為 Enable 32-bit Applications = false 以使用 64-bit 模式。

    3. 記憶體分配請求太大

    例如:


    byte[] buffer = new byte[int.MaxValue];    // 2GB 以上,通常直接炸   
    

    單次分配請求超出上限也會立即引發 OutOfMemoryException,即使整體還有空間。

    4. GC 無法回收記憶體

    記憶體被「誤保留」或長期持有(例如 static 變數、cache、不正確使用 singleton),導致 GC 難以回收。

    三、如何進一步診斷

    使用工具觀察:

    Visual Studio Diagnostic Tools / dotMemory / PerfView / DebugDiag

    註:如果是開發機上就發生 System.OutOfMemoryException,可以這樣;但若開發機上正常,正式機上才發生,要考慮是否合適在正式機安裝偵測工具。

    重點觀察:

    • LOH 占用情況
    • 記憶體碎裂情況
    • 哪些型別的物件持續存在、無法被 GC 回收

    解法建議(對應原因):

    問題類型建議解法
    LOH 碎裂減少大物件的反覆配置,可使用 ArrayPool 或重複利用
    32-bit 限制改用 64-bit 模式(關掉 IIS 的 Enable 32-bit)
    記憶體分配過大拆小 buffer、改用分段讀取、避免一次塞入太多資料
    GC 無法回收檢查 static / cache / singleton / event handler 是否未釋放物件

    註:關掉 IIS 的 Enable 32-bit 有可能導致某些 3rd Party 套件 or 元件在編譯 or 執行時期 ( Runtime ) 出現錯誤。

    (完)

    相關

    2025年4月7日 星期一

    [研究]系統使用有漏洞之舊版 DataTables 1.10.15 ( jquery.datatables 1.10.15) 版元件之處理

    [研究]系統使用有漏洞之舊版 DataTables 1.10.15 ( jquery.datatables 1.10.15) 版元件之處理

    2025-04-07

    ********************************************************************************

    AWVS (Acunetix Web Application Security Scanner) 掃描發現

    DataTables Prototype Pollution Vulnerability

    Severity:High

    Reported by module:/deepscan/javascript_library_audit_deepscan.js

    Description:Affected versions of this package are vulnerable to Prototype Pollution. https://snyk.io/vuln/SNYK-JS-DATATABLESNET-598806

    Impact

    Recommendation

    References

    Affected items

    • Web Server
      • Details
      • datatables v1.10.15-1.10.15
      • Request headers

    ********************************************************************************



    DataTables Improper Neutralization of Input During Web Page Generation ('Cross-siteScripting') Vulnerability

    Severity:Medium

    Reported by module:/deepscan/javascript_library_audit_deepscan.js

    Description

    This affects the package datatables.net before 1.11.3. If an array is passed to the HTML escape entities function it wouldnot have its contents escaped.

    Impact

    Recommendation

    References

    Affected items

    • Web Server
      • Details
      • datatables v1.10.15-1.10.15
      • Request headers

    ********************************************************************************

    FireFox

    ********************************************************************************

    【研究處理】


    發現 packages.config 中有


    <package id="jquery.datatables" version="1.10.15" targetFramework="net48" />  
    

    下圖,jquery.databases 1.10.15 已經是 NuGet 提供的最新版


    jquery.databases 官方下載,目前最新似乎 2.2.2 版
    下圖,目前最新似乎 2.2.2 版

    DataTables/DataTables: Tables plug-in for jQuery
    https://github.com/DataTables/DataTables/tags
    下圖,GitHub似乎最新 1.10.21


    ********************************************************************************

    ASP.NET, WebForm, 下面哪個套件會需要 jquery.datatables 1.10.15 套件?

    AngleSharp 0.17.1
    AngleSharp.Css 0.17.0
    Antlr 3.5.0.2
    Aspose.Cells 25.3.0
    Autofac 8.2.0
    Autofac.WebApi2 6.1.1
    bootstrap 3.4.1
    BouncyCastle.Cryptography 2.5.1
    ByteSize 2.1.2
    ClosedXML 0.104.2
    ClosedXML.Parser 1.3.0
    DocumentFormat.OpenXml 3.3.0
    DocumentFormat.OpenXml.Framework 3.3.0
    DotNetZip 1.16.0
    EFUtilities 1.0.2
    elmah 1.2.2
    elmah.corelibrary 1.2.2
    EntityFramework 6.5.1
    Enums.NET 5.0.0
    ExcelDataReader 3.7.0
    ExcelDataReader.DataSet 3.7.0
    ExcelNumberFormat 1.1.0
    ExtendedNumerics.BigDecimal 3000.0.3.40
    FastMember 1.5.0
    FastMember.Signed 1.5.0
    FreeDataExports 1.1.12
    html5-shiv 3.7.3
    HtmlSanitizer 9.0.876
    Irony 1.5.3
    Irony.NetCore 1.1.11
    JetBrains.Annotations 2024.3.0
    jQuery 3.7.1
    jQuery.UI.Combined 1.14.1
    js-cookie 2.2.1
    LinqKit 1.3.8
    LinqKit.Core 1.2.8
    LogicExtensions 0.0.3
    MailKit 4.11.0
    MathNet.Numerics.Signed 5.0.0
    Microsoft.AspNet.FriendlyUrls 1.0.2
    Microsoft.AspNet.FriendlyUrls.Core 1.0.2
    Microsoft.AspNet.FriendlyUrls.Core.zh-Hant 1.0.2
    Microsoft.AspNet.Identity.Core 2.2.4
    Microsoft.AspNet.Identity.Core.zh-Hant 2.2.4
    Microsoft.AspNet.Identity.EntityFramework 2.2.4
    Microsoft.AspNet.Identity.EntityFramework.zh-Hant 2.2.4
    Microsoft.AspNet.Identity.Owin 2.2.4
    Microsoft.AspNet.Identity.Owin.zh-Hant 2.2.4
    Microsoft.AspNet.Providers.Core 2.0.0
    Microsoft.AspNet.Providers.Core.zh-Hant 2.0.0
    Microsoft.AspNet.ScriptManager.MSAjax 5.0.0
    Microsoft.AspNet.ScriptManager.WebForms 5.0.0
    Microsoft.AspNet.Web.Optimization 1.1.3
    Microsoft.AspNet.Web.Optimization.WebForms 1.1.3
    Microsoft.AspNet.Web.Optimization.zh-Hant 1.1.3
    Microsoft.AspNet.WebApi 5.3.0
    Microsoft.AspNet.WebApi.Client 6.0.0
    Microsoft.AspNet.WebApi.Client.zh-Hant 6.0.0
    Microsoft.AspNet.WebApi.Core 5.3.0
    Microsoft.AspNet.WebApi.Core.zh-Hant 5.3.0
    Microsoft.AspNet.WebApi.WebHost 5.3.0
    Microsoft.AspNet.WebApi.WebHost.zh-Hant 5.3.0
    Microsoft.Bcl.AsyncInterfaces 9.0.3
    Microsoft.Bcl.Build 1.0.21
    Microsoft.Bcl.Cryptography 9.0.3
    Microsoft.Bcl.HashCode 6.0.0
    Microsoft.CSharp 4.7.0
    Microsoft.Extensions.DependencyInjection 9.0.3
    Microsoft.Extensions.DependencyInjection.Abstractions 9.0.3
    Microsoft.IO.RecyclableMemoryStream 3.0.1
    Microsoft.NETCore.Platforms 7.0.4
    Microsoft.Owin 4.2.2
    Microsoft.Owin.Host.SystemWeb 4.2.2
    Microsoft.Owin.Security 4.2.2
    Microsoft.Owin.Security.Cookies 4.2.2
    Microsoft.Owin.Security.OAuth 4.2.2
    Microsoft.Web.Infrastructure 2.0.0
    Microsoft.Win32.Primitives 4.3.0
    MimeKit 4.11.0
    Modernizr 2.8.3
    Moment.js 2.30.1
    NETStandard.Library 2.0.3
    Newtonsoft.Json 13.0.3
    Newtonsoft.Json.Bson 1.0.3
    NLog 5.4.0
    NLog.Schema 5.4.0
    NPOI 2.7.3
    Npoi.Mapper 6.2.2
    Oracle.ManagedDataAccess 23.7.0
    Owin 1.0
    popper.js 1.16.1
    Portable.BouncyCastle 1.9.0
    RBush 4.0.0
    Respond 1.4.2
    RestSharp 106.15.0
    SendGrid 9.29.3
    SendGrid.CSharp.HTTP.Client 3.4.12
    SendGrid.SmtpApi 1.4.6
    SharpZipLib 1.4.2
    SixLabors.Fonts 1.0.1
    SixLabors.ImageSharp 3.1.7
    starkbank-ecdsa 1.3.3
    Swashbuckle 5.6.0
    Swashbuckle.Core 5.6.0
    System.AppContext 4.3.0
    System.Buffers 4.6.1
    System.Collections 4.3.0
    System.Collections.Concurrent 4.3.0
    System.Collections.Immutable 9.0.3
    System.Configuration.ConfigurationManager 9.0.3
    System.Console 4.3.1
    System.Diagnostics.Debug 4.3.0
    System.Diagnostics.DiagnosticSource 9.0.3
    System.Diagnostics.Tools 4.3.0
    System.Diagnostics.Tracing 4.3.0
    System.Formats.Asn1 9.0.3
    System.Globalization 4.3.0
    System.Globalization.Calendars 4.3.0
    System.IO 4.3.0
    System.IO.Compression 4.3.0
    System.IO.Compression.ZipFile 4.3.0
    System.IO.FileSystem 4.3.0
    System.IO.FileSystem.Primitives 4.3.0
    System.IO.Packaging 9.0.3
    System.IO.Pipelines 9.0.3
    System.IO.UnmanagedMemoryStream 4.3.0
    System.Linq 4.3.0
    System.Linq.Dynamic.Core 1.6.0.2
    System.Linq.Expressions 4.3.0
    System.Linq.Queryable 4.3.0
    System.Memory 4.6.2
    System.Net.Http 4.3.4
    System.Net.Primitives 4.3.1
    System.Net.Sockets 4.3.0
    System.Numerics.Vectors 4.6.1
    System.ObjectModel 4.3.0
    System.Reflection 4.3.0
    System.Reflection.Emit.ILGeneration 4.7.0
    System.Reflection.Emit.Lightweight 4.7.0
    System.Reflection.Extensions 4.3.0
    System.Reflection.Primitives 4.3.0
    System.Resources.ResourceManager 4.3.0
    System.Runtime 4.3.1
    System.Runtime.CompilerServices.Unsafe 6.1.1
    System.Runtime.Extensions 4.3.1
    System.Runtime.Handles 4.3.0
    System.Runtime.InteropServices 4.3.0
    System.Runtime.InteropServices.RuntimeInformation 4.3.0
    System.Runtime.Numerics 4.3.0
    System.Security.AccessControl 6.0.1
    System.Security.Cryptography.Algorithms 4.3.1
    System.Security.Cryptography.Encoding 4.3.0
    System.Security.Cryptography.Pkcs 9.0.3
    System.Security.Cryptography.Primitives 4.3.0
    System.Security.Cryptography.X509Certificates 4.3.2
    System.Security.Cryptography.Xml 9.0.3
    System.Security.Permissions 9.0.3
    System.Security.Principal.Windows 5.0.0
    System.Text.Encoding 4.3.0
    System.Text.Encoding.CodePages 9.0.3
    System.Text.Encoding.Extensions 4.3.0
    System.Text.Encodings.Web 9.0.3
    System.Text.Json 9.0.3
    System.Text.RegularExpressions 4.3.1
    System.Threading 4.3.0
    System.Threading.Tasks 4.3.0
    System.Threading.Tasks.Extensions 4.6.2
    System.Threading.Tasks.Parallel 4.3.0
    System.Threading.Timer 4.3.0
    System.ValueTuple 4.6.1
    System.Xml.ReaderWriter 4.3.1
    System.Xml.XDocument 4.3.0
    vue 2.6.11
    WebActivatorEx 2.2.0
    WebGrease 1.6.0
    X.PagedList 10.5.7
    XLParser 1.7.5

    ChatGPT 說:

    在這些套件中,jquery.datatables 1.10.15 這個套件會通常是由那些需要處理資料表格並提供高度互動性的功能(例如排序、搜尋、分頁等)來使用。如果你的專案中有使用到 DataTables 函式庫來增強表格功能,這個套件將會是需要的。

    根據你的清單,並沒有直接顯示 jquery.datatables 1.10.15。可能需要你額外加入這個套件,或者有其他套件會依賴它。例如,如果你有使用 jQuery 且有資料表格的功能需求,這時候可能會需要 jquery.datatables。

    如果是問是否有其他套件會隱式依賴 jquery.datatables,常見的情況是:
    * 任何涉及 UI 表格展示並需要高度互動的庫,像是 Bootstrap (搭配 DataTables 的樣式)。
    * 某些前端的資料顯示框架或插件,可能會需要這個套件來增強表格功能。

    你可以進一步檢查專案中是否有這類需求,並安裝 jquery.datatables。

    ********************************************************************************

    下圖,Visual Studio 2019 直接移除 jquery.datatables 1.10.15 看看

    下圖,Build / compile 成功

    下圖,發佈 ( Deploy) 成功


    實際進行登入和使用,目前沒發現問題。

    ********************************************************************************
    搜尋 DataTables,移除引用的

    發現 Site.Master 中有
    <script type="text/javascript" src="<%= Page.ResolveClientUrl("~/Scripts/DataTables/jquery.dataTables.min.js") %>"></script>

    ********************************************************************************

    下圖,把網址貼到  FireFox 瀏覽器,按下 F12,選「主控台」,輸入 $.fn.dataTable.version 顯示版本,因為移除,查不到版本了。


    ********************************************************************************
    (完)

    相關

    [研究]系統使用有漏洞之舊版 DataTables 1.10.15 ( jquery.datatables 1.10.15) 版元件之處理
    https://shaurong.blogspot.com/2025/04/datatables-11015-jquerydatatables-11015.html

    [研究]ASP.NET 請問 jquery.dataTables.min.js 和 dataTables.bootstrap.min.js 是甚麼套件的檔案?
    https://shaurong.blogspot.com/2025/04/aspnet-jquerydatatablesminjs.html

    [研究]用 Libman 安裝 DataTables 1.9.4 ( jquery.datatables 1.9.4 ) 元件
    https://shaurong.blogspot.com/2025/04/libman-datatables-194-jquerydatatables.html

    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例
    https://shaurong.blogspot.com/2025/04/aspnet-webform-datatables-11015.html


    [研究]ASP.NET 請問 jquery.dataTables.min.js 和 dataTables.bootstrap.min.js 是甚麼套件的檔案?

    [研究]ASP.NET 請問 jquery.dataTables.min.js 和 dataTables.bootstrap.min.js 是甚麼套件的檔案?

    2025-04-07

    環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

    ********************************************************************************

    ASP.NET, WebForm, 請問這2個檔案分別是甚麼套件的檔案 ?

    ~/Scripts/DataTables/jquery.dataTables.min.js

    ~/Scripts/DataTables/dataTables.bootstrap.min.js

    ChatGPT 說:

    這兩個檔案是 jQuery DataTables 套件及其 Bootstrap 整合樣式 的 JavaScript 檔案,主要用於在 ASP.NET WebForm(或其他前端框架)中建立強大的 HTML 表格功能,例如排序、分頁、即時搜尋等。

    各檔案說明:

    1.~/Scripts/DataTables/jquery.dataTables.min.js

    • 這是 DataTables 的主程式核心,由 jQuery 提供支援。
    • 功能包含:資料表的排序、分頁、搜尋等互動功能。
    • 套件名稱:DataTables
    • 官方網站:https://datatables.net/

    2.~/Scripts/DataTables/dataTables.bootstrap.min.js

    • 這是 DataTables 與 Bootstrap 樣式整合的 JS 套件。
    • 它不會改變核心邏輯,但會讓 DataTables 看起來符合 Bootstrap 的 UI 風格(按鈕、表格外觀等)。
    • 此檔案是選配,用來讓 DataTables 與 Bootstrap (v3) 相容。
    • 若你使用 Bootstrap 4 或 5,應改用對應版本的整合檔案(如 dataTables.bootstrap4.min.js)。

    ********************************************************************************

    常見搭配檔案(補充):

    CSS:

    <link rel="stylesheet" href="~/Content/DataTables/css/dataTables.bootstrap.min.css" />
    

    JavaScript 載入順序建議:

    <script src="~/Scripts/jquery-3.x.x.min.js"></script>
    <script src="~/Scripts/DataTables/jquery.dataTables.min.js"></script>
    <script src="~/Scripts/DataTables/dataTables.bootstrap.min.js"></script>
    

    如果你是從 NuGet 或手動下載方式引入,可以確認是否安裝了以下任一套件:

    NuGet 套件名稱(可能安裝來源):

    • DataTables.Net
    • DataTables.Net.Bootstrap
    • DataTables.Mvc(若是 MVC 專案)

    (完)

    相關

    [研究]系統使用有漏洞之舊版 DataTables 1.10.15 ( jquery.datatables 1.10.15) 版元件之處理
    https://shaurong.blogspot.com/2025/04/datatables-11015-jquerydatatables-11015.html

    [研究]ASP.NET 請問 jquery.dataTables.min.js 和 dataTables.bootstrap.min.js 是甚麼套件的檔案?
    https://shaurong.blogspot.com/2025/04/aspnet-jquerydatatablesminjs.html

    [研究]用 Libman 安裝 DataTables 1.9.4 ( jquery.datatables 1.9.4 ) 元件
    https://shaurong.blogspot.com/2025/04/libman-datatables-194-jquerydatatables.html

    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例
    https://shaurong.blogspot.com/2025/04/aspnet-webform-datatables-11015.html


    [研究]用 Libman 安裝 DataTables 1.9.4 ( jquery.datatables 1.9.4 ) 元件

    [研究]用 Libman 安裝 DataTables 1.9.4 ( jquery.datatables 1.9.4 ) 元件

    2025-04-07

    環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

    ********************************************************************************

    續這篇,註解掉 1.10.15 那兩行後

    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例
    https://shaurong.blogspot.com/2025/04/aspnet-webform-datatables-11015.html

    (下圖) 最新只有 1.9.4 版




    libman.json 內容

    {
      "version": "1.0",
      "defaultProvider": "cdnjs",
      "libraries": [
        {
          "library": "datatables@1.9.4",
          "destination": "lib/datatables/"  
        }
      ]
    }
    
    

    Default.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <!-- 引入 DataTables 的 CSS -->
        <%--<link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" />--%>
        <link href="lib/datatables/css/jquery.dataTables.min.css" rel="stylesheet" />
    
        <!-- 引入 jQuery 和 DataTables 的 JavaScript -->
        <script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
        <%--<script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>--%>
        <script type="text/javascript" src="lib/datatables/jquery.dataTables.min.js"></script>
        <style type="text/css">
            body {
                font-family: Arial, sans-serif;
                margin: 20px;
            }
    
            table {
                width: 100%;
                margin: 20px 0;
                border-collapse: collapse;
            }
    
            th, td {
                padding: 8px;
                text-align: left;
                border-bottom: 1px solid #ddd;
            }
    
            th {
                background-color: #f2f2f2;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <h2>DataTables 範例</h2>
    
                <!-- 建立 DataTables 表格 -->
                <table id="example" class="display">
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>職位</th>
                            <th>年齡</th>
                            <th>開始日期</th>
                            <th>薪水</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Tiger Nixon</td>
                            <td>System Architect</td>
                            <td>61</td>
                            <td>2011/04/25</td>
                            <td>$320,800</td>
                        </tr>
                        <tr>
                            <td>Garrett Winters</td>
                            <td>Accountant</td>
                            <td>63</td>
                            <td>2011/07/25</td>
                            <td>$170,750</td>
                        </tr>
                        <tr>
                            <td>Ashton Cox</td>
                            <td>Junior Technical Author</td>
                            <td>66</td>
                            <td>2009/01/12</td>
                            <td>$86,000</td>
                        </tr>
                        <tr>
                            <td>Cedric Kelly</td>
                            <td>Senior Javascript Developer</td>
                            <td>22</td>
                            <td>2012/03/29</td>
                            <td>$433,060</td>
                        </tr>
                        <tr>
                            <td>Airi Satou</td>
                            <td>Accountant</td>
                            <td>33</td>
                            <td>2008/11/28</td>
                            <td>$162,700</td>
                        </tr>
                        <!-- 你可以繼續增加更多資料列 -->
                    </tbody>
                </table>
            </div>
        </form>
    
        <script type="text/javascript">
            // 初始化 DataTable
            $(document).ready(function () {
                $('#example').DataTable();
            });
        </script>
    </body>
    </html>
    
    



    下圖,把網址貼到  FireFox 瀏覽器,按下 F12,選「主控台」,輸入 $.fn.dataTable.version 顯示版本

    移除套件,把 libman,json 改成

    {
      "version": "1.0",
      "defaultProvider": "cdnjs",
      "libraries": [
      ]
    }
    
    

    存檔後,就會自動移除 bootstrap了。

    ********************************************************************************

    註:其實還可以考慮用 npm 安裝,但敝人電腦沒有安裝 node.js 和 npm,就不多談了。

    npm install datatables.net

    npm install datatables.net-dt


    (完)

    相關

    [研究]系統使用有漏洞之舊版 DataTables 1.10.15 ( jquery.datatables 1.10.15) 版元件之處理
    https://shaurong.blogspot.com/2025/04/datatables-11015-jquerydatatables-11015.html

    [研究]ASP.NET 請問 jquery.dataTables.min.js 和 dataTables.bootstrap.min.js 是甚麼套件的檔案?
    https://shaurong.blogspot.com/2025/04/aspnet-jquerydatatablesminjs.html

    [研究]用 Libman 安裝 DataTables 1.9.4 ( jquery.datatables 1.9.4 ) 元件
    https://shaurong.blogspot.com/2025/04/libman-datatables-194-jquerydatatables.html

    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例
    https://shaurong.blogspot.com/2025/04/aspnet-webform-datatables-11015.html



    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例

    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例

    2025-04-07

    環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

    ********************************************************************************

    Default.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1.Default" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <title></title>
            <!-- 引入 DataTables 的 CSS -->
        <link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" />
    
        <!-- 引入 jQuery 和 DataTables 的 JavaScript -->
        <script type="text/javascript" src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
        <script type="text/javascript" src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
        <style type="text/css">
            body {
                font-family: Arial, sans-serif;
                margin: 20px;
            }
            table {
                width: 100%;
                margin: 20px 0;
                border-collapse: collapse;
            }
            th, td {
                padding: 8px;
                text-align: left;
                border-bottom: 1px solid #ddd;
            }
            th {
                background-color: #f2f2f2;
            }
        </style>
    </head>
    <body>
    <form id="form1" runat="server">
            <div>
                <h2>DataTables 範例</h2>
    
                <!-- 建立 DataTables 表格 -->
                <table id="example" class="display">
                    <thead>
                        <tr>
                            <th>姓名</th>
                            <th>職位</th>
                            <th>年齡</th>
                            <th>開始日期</th>
                            <th>薪水</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Tiger Nixon</td>
                            <td>System Architect</td>
                            <td>61</td>
                            <td>2011/04/25</td>
                            <td>$320,800</td>
                        </tr>
                        <tr>
                            <td>Garrett Winters</td>
                            <td>Accountant</td>
                            <td>63</td>
                            <td>2011/07/25</td>
                            <td>$170,750</td>
                        </tr>
                        <tr>
                            <td>Ashton Cox</td>
                            <td>Junior Technical Author</td>
                            <td>66</td>
                            <td>2009/01/12</td>
                            <td>$86,000</td>
                        </tr>
                        <tr>
                            <td>Cedric Kelly</td>
                            <td>Senior Javascript Developer</td>
                            <td>22</td>
                            <td>2012/03/29</td>
                            <td>$433,060</td>
                        </tr>
                        <tr>
                            <td>Airi Satou</td>
                            <td>Accountant</td>
                            <td>33</td>
                            <td>2008/11/28</td>
                            <td>$162,700</td>
                        </tr>
                        <!-- 你可以繼續增加更多資料列 -->
                    </tbody>
                </table>
            </div>
        </form>
    
        <script type="text/javascript">
            // 初始化 DataTable
            $(document).ready(function () {
                $('#example').DataTable();
            });
        </script>
    </body>
    </html>
    
    
    


    下圖,註解掉 1.10.15 那兩行後

    (完)

    相關

    [研究]系統使用有漏洞之舊版 DataTables 1.10.15 ( jquery.datatables 1.10.15) 版元件之處理
    https://shaurong.blogspot.com/2025/04/datatables-11015-jquerydatatables-11015.html

    [研究]ASP.NET 請問 jquery.dataTables.min.js 和 dataTables.bootstrap.min.js 是甚麼套件的檔案?
    https://shaurong.blogspot.com/2025/04/aspnet-jquerydatatablesminjs.html

    [研究]用 Libman 安裝 DataTables 1.9.4 ( jquery.datatables 1.9.4 ) 元件
    https://shaurong.blogspot.com/2025/04/libman-datatables-194-jquerydatatables.html

    [研究]ASP.NET, WebForm, 使用DataTables 1.10.15 ( jquery.datatables 1.10.15) 元件範例
    https://shaurong.blogspot.com/2025/04/aspnet-webform-datatables-11015.html


    [研究]ASP.NET, NuGet 安裝 bootstrap 3.4.1 會安裝那些套件

    [研究]ASP.NET, NuGet 安裝 bootstrap 3.4.1 會安裝那些套件

    2025-04-07

    環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19

    ********************************************************************************

    WebApplication1

    正在安裝:

    jQuery.1.9.1

    bootstrap.3.4.1



    ********************************************************************************

    【bootstrap 3.4.1 不更新,更新其他】

    WebApplication1

    更新:

    Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1 -> Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0

    jQuery.1.9.1 -> jQuery.3.7.1


    ********************************************************************************

    (完)

    相關

    [研究]如何開啟 nmap 掃描結果的 .gnmap , .nmap 和 .xml 檔案 ?

    [研究]如何開啟 nmap 掃描結果的 .gnmap , .nmap 和 .xml 檔案 ?

    2025-04-07

    .nmap → 傳統純文字格式(人類可讀)

    .gnmap → 「grepable」格式,適合腳本分析

    .xml → XML 格式,適合工具整合(如 Nmap Parser、Vulners 等)

    (完)


    2025年4月5日 星期六

    [研究]「指定掃描期間的 CPU 使用率百分比上限」設定

    [研究]「指定掃描期間的 CPU 使用率百分比上限」設定

    2025-04-05

    偶然看到一個影片,說CPU若常常100%,說把「指定掃描期間的 CPU 使用率百分比上限」設定為 0% 就可以解決,影片操作很快讓人難跟上,敝人以圖片呈現,並討論一下。

    (下圖) 啟動 gpedit.exe 本機群組原則編輯器 (Local Group Policy Editor)




    這個原則設定可讓您設定掃描期間允許的 CPU 使用率百分比上限。這個設定的有效值是以整數 5 到 100 表示的百分比。0 值代表沒有 CPU 使用率節流。預設值為 50。

    如果您啟用這個設定,CPU 使用率將不會超過指定的百分比。

    如果您停用或未設定這個設定,CPU 使用率將不會超過預設值。

    ********************************************************************************

    實際測試,點選「已啟用」瞬間會變成50%,輸入0%,按下「確定」按鈕後,再次開啟,會變成「已停用」,百分比是0,灰色,無法更改。等於是把防毒掃描功能關閉了。

    為了避免CPU常100%而關閉防毒掃描,這作法值得考慮。

    (完) 


    [研究]Edge 和 IE 是否支援 Outlook 中檢視 .mht 內容 ?

    [研究]Edge 和 IE (Internet Explorer ) 是否支援檢視 .mht 內容  ?
    [研究]Edge 和 IE (Internet Explorer ) 是否支援 Outlook 中檢視 .mht 內容  ?

    2025-04-05

    偶然發現Email內容用 Edge 不能看,要 IE 才行。(環境 Windows Server 2019 + Outlook 2019)

    ********************************************************************************

    測試,Outlook 中 .mht 內容 用 Edge 和 IE 開啟測試







    ********************************************************************************
    測試,建立一個 .mht (網頁封存,單一檔案) 用 Edge 和 IE 開啟測試




    ********************************************************************************

     Edge 和 IE 是否支援檢視 .mht 內容  ? Edge 和 IE 是否支援 Outlook 中檢視 .mht 內容  ?

    ChatGPT 說:

    以下是關於 Microsoft Edge 和 Internet Explorer (IE) 是否支援 .mht 檔案(MIME HTML)的詳細說明,包括在 Outlook 中檢視的情況:

    🔍 一般情況:Edge 和 IE 是否支援開啟 .mht 檔案?

    瀏覽器是否支援 .mht
    Internet Explorer (IE)✅ 原生支援,可以直接開啟 .mht 檔案。
    舊版 Edge (EdgeHTML)❌ 不支援。無法直接開啟 .mht 檔案。
    新版 Edge (Chromium)❌ 不支援。預設無法直接開啟 .mht 檔案,會下載檔案。

    📌 備註:MHT(MHTML)是一種單一網頁封裝格式,IE 是少數原生支援的瀏覽器。


    📧 Outlook 中檢視 .mht 附件的支援情況

    瀏覽器/應用程式是否可在 Outlook 中檢視 .mht
    Outlook + IE (內嵌 IE)✅ 可以正確開啟 .mht 附件(IE 是 Outlook 的預設 HTML 引擎直到 Outlook 2016/2019)。
    Outlook + Edge (Chromium)❌ 不支援嵌入 .mht 預覽。Outlook 會提示另存或外部開啟。

    📌 Outlook 仍依賴 IE 引擎來渲染部分 HTML 內容,尤其是在舊版(如 Outlook 2016、2019)中。但 .mht 檔案仍需下載後以 IE 開啟。Edge Chromium 並未整合 .mht 的支援功能進 Outlook。

    ✅ 建議處理方式

    • 要開啟 .mht 檔案:請使用 IE(若仍安裝)或轉存成 .html 再用瀏覽器開啟。
    • 若使用 Edge Chromium:可考慮轉檔(例如用 IE 開啟後另存為 .pdf)或使用第三方工具。
    • Outlook 中接收到 .mht 附件時:
      • 若系統仍有 IE,可以直接用 IE 開啟。
      • 若已無 IE,需下載後用 Word 或第三方支援 .mht 的工具開啟。

    需要我提供 .mht 轉換 HTML 或 PDF 的範例工具嗎?或者你是在 Outlook 裡遇到特定顯示問題?可以幫你檢查或解決。

    (完)