| 現象 | 可能原因 | 排查方向 |
|---|---|---|
| 圖片顯示紅叉(X) | 伺服端元件未註冊/權限不足 | 檢查 ADODB.Stream、FSO |
| 圖片正常但驗證永失敗 | Client 端 Cookie 被封鎖 | 瀏覽器隱私設定、跨域 Cookie 政策 |
| Session 值遺失 | 應用程式池回收、Web Garden、Session State 設定 | IIS 設定、機器金鑰一致性 |
設定 → 隱私權與安全性 → Cookie → 允許第一方 Cookie。設定 → 隱私權與安全性 → Cookie 和其他網站資料 → 允許所有 Cookie 或加入例外網站。選項 → 隱私權與安全性 → Cookie 與網站資料 → 接受。/imgchk/validatecode.asp)。Server.CreateObject 失敗 / ASP 0177,確認元件問題。REM 1. 重新註冊 ADODB.Stream
regsvr32 "C:\Program Files\Common Files\System\ado\msado15.dll"
REM 2. 重新註冊 FileSystemObject (scrrun.dll)
regsvr32 /u scrrun.dll
regsvr32 scrrun.dll
REM 3. 若為 64 位元系統且 IIS 運行 32 位元模式
%windir%\SysWOW64\regsvr32 "C:\Program Files (x86)\Common Files\System\ado\msado15.dll"
%windir%\SysWOW64\regsvr32 scrrun.dll
無法自行註冊元件,請直接聯繫空間商技術支援,說明「ASP 驗證碼元件 ADODB.Stream / FSO 未啟用」。
validatecode.asp 有正確寫入 Session("xxx_ValidateCode")。Response.Write 輸出圖片前已有其他輸出(導致標頭已送出)。Response.ContentType = "image/jpeg"(或 png/gif)正確設定。