LOGO OA教程 ERP教程 模切知識交流 PMS教程 CRM教程 開發文檔 其他文檔  
 
網站管理員

utf-8編碼出錯iis錯誤提示亂碼解決方法

liguoquan
2025年8月20日 17:25 本文熱度 426
:utf-8編碼出錯iis錯誤提示亂碼解決方法


utf-8編碼出錯iis錯誤提示亂碼解決方法

轉載于 2018-08-04 13:17:04 發布·2.8k 閱讀
·0
· 1
文章標簽:

#IIS配置

 本文介紹了解決IIS7環境下UTF-8編碼網站出現亂碼問題的方法。通過調整500-100.asp文件編碼及配置IIS錯誤頁,實現錯誤信息的正常顯示。

摘要生成于 C知道 ,由 DeepSeek-R1 滿血版支持, 前往體驗 >

本文來自:https://blog.csdn.net/chengshiruxia/article/details/43526001

感謝原創的奉獻!

網站為utf-8編碼時IIS環境下運行出錯時iis給出的提示亂碼解決方法,本方法本人試個絕對可行,asp出錯時iis亂碼最終解決辦法,utf-8編碼網站出錯iis提示亂碼主要是因為IIS7的錯誤信息輸出默認使用的是GB2312編碼,這樣會導致IIS7出現運行時錯誤的信息會是亂碼,影響我們糾錯

在調試站點環境時,如果系統開發編碼使用的是UTF-8,iis錯誤提示亂碼解決方法。

1、將C:\inetpub\custerr\zh-CN\500-100.asp文件復制到你的站點文件夾下;  


2、將這個文件另存為utf-8編碼:  
  a. 頭部加上 @codepage=65001;  如:<%@ language="VBScript" @codepage=65001 %>
  b. option explicit后面加上一行response.charset="utf-8";  
  c. 將“<META HTTP-EQUIV="Content-Type" Content="text/html; charset=gb2312">”修改為“<META HTTP-EQUIV="Content-Type" Content="text/html; charset=utf-8">”; 

3. 配置IIS。  
a. 打開IIS,選擇你建立的站點,在右邊窗口雙擊“錯誤頁”圖標,選擇右邊屬性窗口下的“添加...”操作。  
b. 添加自定義錯誤頁窗口中,狀態代碼“500.100”。這里本來我想參照IIS6設置為500-100,結果系統提示不通過。響應操作,我們這里選擇“在此網站上執行URL”,URL地址“/siteName/500-100.asp”(siteName為你的虛擬站點名稱),如果建立的站點,這里只要輸入相對于站點根目錄的URL地址。 
4. 確定后,這樣utf-8編碼站點顯示的出錯信息有會詳細的描述了不會是亂碼了。

 

示例:

  1. <%@ language="VBScript" @codepage=65001 %>
  2. <%
  3.  Option Explicit
  4.  response.charset="utf-8"
  5.  Const lngMaxFormBytes = 200
  6.  Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP
  7.  Dim strMethod, lngPos, datNow, strQueryString, strURL
  8.  If Response.Buffer Then
  9.    Response.Clear
  10.    Response.Status = "500 Internal Server Error"
  11.    Response.ContentType = "text/html"
  12.    Response.Expires = 0
  13.  End If
  14.  Set objASPError = Server.GetLastError
  15. %>
  16. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  17. <HTML><HEAD><TITLE>無法顯示該頁</TITLE>
  18. <META HTTP-EQUIV="Content-Type" Content="text/html; charset=utf-8">
  19. <STYLE type="text/css">
  20.  BODY { font: 8pt/12pt verdana }
  21.  H1 { font: 13pt/15pt verdana }
  22.  H2 { font: 8pt/12pt verdana }
  23.  A:link { color: red }
  24.  A:visited { color: maroon }
  25. </STYLE>
  26. </HEAD><BODY><TABLE width=500 border=0 cellspacing=10><TR><TD>
  27. <h1>無法顯示該頁</h1>
  28. 您嘗試訪問的頁面有問題,無法顯示。
  29. <hr>
  30. <p>請嘗試以下操作:</p>
  31. <ul>
  32. <li>與網站管理員聯系,告知對方此 URL 地址出現了此錯誤。</li>
  33. </ul>
  34. <h2>HTTP 500.100 - 內部服務器錯誤: ASP 錯誤。<br>Internet Information Services</h2>
  35. <hr>
  36. <p>技術信息(針對支持人員)</p>
  37. <ul>
  38. <li>錯誤類型:<br>
  39. <%
  40.  Dim bakCodepage
  41.  on error resume next
  42. bakCodepage = Session.Codepage
  43. Session.Codepage = 1252
  44.  on error goto 0
  45.  Response.Write Server.HTMLEncode(objASPError.Category)
  46.  If objASPError.ASPCode > "" Then Response.Write Server.HTMLEncode(", " & objASPError.ASPCode)
  47.    Response.Write Server.HTMLEncode(" (0x" & Hex(objASPError.Number) & ")" ) & "<br>"
  48.  If objASPError.ASPDescription > "" Then
  49. Response.Write Server.HTMLEncode(objASPError.ASPDescription) & "<br>"
  50.  elseIf (objASPError.Description > "") Then
  51. Response.Write Server.HTMLEncode(objASPError.Description) & "<br>"
  52.  end if
  53.  blnErrorWritten = False
  54.  ' Only show the Source if it is available and the request is from the same machine as IIS
  55.  If objASPError.Source > "" Then
  56.    strServername = LCase(Request.ServerVariables("SERVER_NAME"))
  57.    strServerIP = Request.ServerVariables("LOCAL_ADDR")
  58.    strRemoteIP =  Request.ServerVariables("REMOTE_ADDR")
  59.    If (strServerIP = strRemoteIP) And objASPError.File <> "?" Then
  60.      Response.Write Server.HTMLEncode(objASPError.File)
  61.      If objASPError.Line > 0 Then Response.Write ", line " & objASPError.Line
  62.      If objASPError.Column > 0 Then Response.Write ", column " & objASPError.Column
  63.      Response.Write "<br>"
  64.      Response.Write "<font style=""COLOR:000000; FONT: 8pt/11pt courier new""><b>"
  65.      Response.Write Server.HTMLEncode(objASPError.Source) & "<br>"
  66.      If objASPError.Column > 0 Then Response.Write String((objASPError.Column - 1), "-") & "^<br>"
  67.      Response.Write "</b></font>"
  68.      blnErrorWritten = True
  69.    End If
  70.  End If
  71.  If Not blnErrorWritten And objASPError.File <> "?" Then
  72.    Response.Write "<b>" & Server.HTMLEncode(  objASPError.File)
  73.    If objASPError.Line > 0 Then Response.Write Server.HTMLEncode(", line " & objASPError.Line)
  74.    If objASPError.Column > 0 Then Response.Write ", column " & objASPError.Column
  75.    Response.Write "</b><br>"
  76.  End If
  77. %>
  78. </li>
  79. <li>瀏覽器類型:<br>
  80. <%= Server.HTMLEncode(Request.ServerVariables("HTTP_USER_AGENT")) %>
  81. <br><br></li>
  82. <li>頁面:<br>
  83. <%
  84.  strMethod = Request.ServerVariables("REQUEST_METHOD")
  85.  Response.Write strMethod & " "
  86.  If strMethod = "POST" Then
  87.    Response.Write Request.TotalBytes & " bytes to "
  88.  End If
  89.  Response.Write Request.ServerVariables("SCRIPT_NAME")
  90.  Response.Write "</li>"
  91.  If strMethod = "POST" Then
  92.    Response.Write "<p><li>POST Data:<br>"
  93.    ' On Error in case Request.BinaryRead was executed in the page that triggered the error.
  94.    On Error Resume Next
  95.    If Request.TotalBytes > lngMaxFormBytes Then
  96.      Response.Write Server.HTMLEncode(Left(Request.Form, lngMaxFormBytes)) & " . . ."
  97.    Else
  98.      Response.Write Server.HTMLEncode(Request.Form)
  99.    End If
  100.    On Error Goto 0
  101.    Response.Write "</li>"
  102.  End If
  103. %>
  104. <br><br></li>
  105. <li>時間:<br>
  106. <%
  107.  datNow = Now()
  108.  Response.Write Server.HTMLEncode(FormatDateTime(datNow, 1) & ", " & FormatDateTime(datNow, 3))
  109.  on error resume next
  110. Session.Codepage = bakCodepage
  111.  on error goto 0
  112. %>
  113. <br><br></li>
  114. <li>詳細信息:<br>
  115. <%  
  116.  strQueryString = "prd=iis&sbp=&pver=5.0&ID=500;100&cat=" & Server.URLEncode(objASPError.Category) & "&os=&over=&hrd=&Opt1=" & Server.URLEncode(objASPError.ASPCode)  & "&Opt2=" & Server.URLEncode(objASPError.Number) & "&Opt3=" & Server.URLEncode(objASPError.Description)
  117.  strURL = "http://www.microsoft.com/ContentRedirect.asp?" & strQueryString
  118. %>
  119.  <ul>
  120.  <li>單擊 <a href="<%= strURL %>">Microsoft 支持</a>,可以找到有關此錯誤的文章鏈接。</li>
  121.  <li>轉到 <a href="http://go.microsoft.com/fwlink/?linkid=8180" target="_blank">Microsoft 產品支持服務</a>,執行標題搜索,查找詞語 <b>HTTP</b><b>500</b>。</li>
  122.  <li>打開 <b>IIS 幫助</b>(可從 IIS 管理器(inetmgr)訪問),搜索主題<b>網站管理</b><b>關于自定義錯誤消息</b></li>
  123.  <li>在 IIS 軟件開發包(SDK)中,或者在 <a href="http://go.microsoft.com/fwlink/?LinkId=8181">MSDN 聯機庫</a>中,搜索主題<b>調試 ASP 腳本</b>、<b>調試組件</b><b>調試 ISAPI 擴展功能和篩選器</b>。</li>
  124.  </ul>
  125. </li>
  126. </ul>
  127. </TD></TR></TABLE></BODY></HTML>
html

該文章在 2025/8/20 17:25:38 編輯過
關鍵字查詢
相關文章
正在查詢...
點晴ERP是一款針對中小制造業的專業生產管理軟件系統,系統成熟度和易用性得到了國內大量中小企業的青睞。
點晴PMS碼頭管理系統主要針對港口碼頭集裝箱與散貨日常運作、調度、堆場、車隊、財務費用、相關報表等業務管理,結合碼頭的業務特點,圍繞調度、堆場作業而開發的。集技術的先進性、管理的有效性于一體,是物流碼頭及其他港口類企業的高效ERP管理信息系統。
點晴WMS倉儲管理系統提供了貨物產品管理,銷售管理,采購管理,倉儲管理,倉庫管理,保質期管理,貨位管理,庫位管理,生產管理,WMS管理系統,標簽打印,條形碼,二維碼管理,批號管理軟件。
點晴免費OA是一款軟件和通用服務都免費,不限功能、不限時間、不限用戶的免費OA協同辦公管理系統。
Copyright 2010-2025 ClickSun All Rights Reserved

黄频国产免费高清视频,久久不卡精品中文字幕一区,激情五月天AV电影在线观看,欧美国产韩国日本一区二区
在线观看亚洲h视频 | 欧美成αⅴ人在线观看 | 中日韩精品视频在线观看 | 日本三级香港三级乳网站 | 久久精品国产亚洲777 | 性刺激的欧美三级中文字幕 |