이 기사는 주로 ASP의 오류 객체를 소개합니다
vbscript에는 스크립트 통역사가 런타임 오류를 무시하고 스크립트 코드의 실행을 계속하게하는 ON ERROR 이력서 다음 문이 있습니다. 그런 다음 스크립트는 err.number 속성의 값을 확인하여 오류가 발생했는지 확인할 수 있습니다. 오류가 발생하면 0이 아닌 값이 반환됩니다. ASP3.0에서는 OnerRorgoto0을 사용하여 기본 오류 처리로 돌아갈 수도 있습니다. 이러한 종류의 처리는 실제로 ASP2.0에서 수행되지만 해당 문서 설명은 없습니다.이 설명은 많은 ASP 데이터 관련 처리 파일에서 공통적입니다.
- iferrthen
- err.clear
- 응답에 오류가 있습니다 .Write!
- 응답. 엔드
- endif
더 자세한 오류 설명을 얻으려면 ASP3.0의 새로운 객체는 ASP의 마지막 오류를 통해 얻을 수 있습니다. VBScript의 ERR 객체는 언제든지 ASP 사용자 정의 오류 페이지에서만 사용할 수 있는지 확인할 수 없습니다. ERR 객체와 같이 기본 오류 처리가 꺼져 (ON Error Resume Next 문을 사용하여) getLasterror 메소드는 오류 자세한 데이터에 액세스 할 수 없습니다.
Asperror 객체의 속성 :
Asperror 객체는 발생한 오류의 특성과 소스를 나타내는 9 가지 속성을 제공하고 오류와 설명을 일으킨 실제 코드를 반환합니다.
아스프 코드 : 정수. 0x800A009와 같은 ASP/IIS에 의해 생성 된 오류 번호
aspdescription : 문자열 유형. 이 오류는 ASP 관련 오류 인 경우이 속성은 예를 들어 오류에 대한 자세한 설명입니다. 0; Windowsnt5 .0; (R11.5)) .. 쿠키와 같은 보고서도 있습니다.
카테고리 : 문자열 유형. 오류의 원인은 ASP 내부 스크립팅 언어 또는 객체의 원인입니다.
열 : 정수. 오류를 생성 한 파일의 문자 위치
설명 : 문자열 유형. 오류에 대한 간단한 설명
파일 : 문자열 유형. 오류가 발생했을 때 처리중인 파일 이름
라인 : 정수. 오류를 생성 한 파일의 줄 번호
번호 : 정수. 표준 COM 오류 코드
출처 : 문자열 유형. 오류를 제기 한 라인의 실제 코드
좋아, 이것은 9 개의 속성이다.
asperror.property
그게 다야 :
asperror.aspcode ()
asperror.aspdescription ()
asperror.category ()
asperror.column ()
asperror.description ()
asperror.file ()
asperror.line ()
asperror.number ()
asperror.source ()
IIS가 지원하는 모든 디렉토리 (또는 오류 매핑 속성을 편집하는 디렉토리)의 모든 디렉토리의 모든 페이지에서 ASP 관련 오류가 발생하면 사용자 정의 오류 페이지가로드됩니다. 실제로이 디렉토리의 모든 웹 페이지의 ASP 런타임 오류가 사용자 정의 된 오류 페이지가 IIS의 기본 설치 부분이 트리거되므로 일반 스크립트 오류 트랩이 설정되었습니다. 사용자 정의. 예를 들어, 디렉토리에 존재하지 않는 웹 페이지를 입력하십시오. 현재 문서 문서 개체의 URL (문서 개체의 URL 속성에서 검색 됨)은 페이지에 표시됩니다.
- <! doctypehtmlpublic- // w3c // dtdhtml3.2final // en>
- <htmldir = ltr>
- <헤드>
- <style> a : 링크 {font : 9pt/11pt 安安; color : ff0000} a : 방문 {font : 9pt/11pt 安安安安; color :#4e4e4e}
- </스타일>
- <metaname = robotscontent = noindex>
- <title> 웹 페이지를 찾을 수 없습니다 </title>
- <metahttp-equiv = content-typecontent = text-html; charset = gb2312>
- <metaname = ms.localecontent = en-cn>
- </head>
- <cript>
- functionhomepage () {
- <!-
- // inRealBits, urlSgetErturnEdToourScriptLikethis :
- //res://shdocvw.dll/http_404.htm#http://www.docurl.com/bar.htm
- //fortestingusedocurl=res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm
- docurl = document.url;
- // thisiswherethehttporhttpswillbe, asfoundbysearchingfor : // butskippingtheres : //
- protocolindex = docurl.indexof (: //, 4);
- // thisfindsHeendingSlashforthedomainserver
- ServerIndex = docurl.indexof (/, protocolindex+3);
- // thehref, weneedavalidurltothedomain.wesearch의 #symboltofindthebegining
- //ofthetrueurl,andadd1toskipit-thisistthebeginurlvalue.weuseserverindexastheendmarker.
- //urlresult=docurl.substring(protocolindex-4,serverindex);
- beginurl = docurl.indexof (#, 1) +1;
- urlresult = docurl.substring (starturl, serverIndex);
- // fordisplay, weneedtoskipfterhttp : //, andgotothenextslash
- displayResult = docUrl.SubString (ProtocolIndex+3, ServerIndex);
- insertElementAnchor (urlresult, displayResult);
- }
- functionhtmlencode (텍스트)
- {
- returnText.replace (/&/g, '&'). 교체 (/'/g,' '). 교체 (/</g,'< '). 교체 (// g,'> ');
- }
- functiontagattrib (이름, 가치)
- {
- return ''+name+'='+htmlencode (value)+'';
- }
- functionprinttag (tagname, needclosetag, attrib, 내부) {
- document.write ( '<'+tagname+attrib+'>'+htmlencode (내부));
- if (needclosetag) document.write ( '</'+tagname+'>');
- }
- 기능 루리 (HREF)
- {
- iEder = window.navigator.appversion;
- IEDER = IEVER.SUBSTR (IEVER.INDEXOF ( 'MSIE')+5,3);
- return (iever.charat (1) == '.'&& iever> = '5.5')?
- Encodeuri (HREF) :
- Escape (href) .replace (/%3a/g, ':'). 교체 (/%3b/g, ';');
- }
- functioninsertElementanchor (href, 텍스트)
- {
- printtag ( 'a', true, tagattrib ( 'href', uri (href)), 텍스트);
- }
- //->
- </script>
- <bodybgcolor = ffffff>
- <tableWidth = 410CellPadding = 3CellPacing = 5>
- <tr>
- <tdalign = leftValign = middlewidth = 360>
- <h1style = color : 000000; font : 12pt/15pt 安安> <!-문제-> 웹 페이지를 찾을 수 없습니다 </h1>
- </td>
- </tr>
- <tr>
- <tdwidth = 400colspan = 2> <fontstyle = color : 000000; font : 9pt/11pt 安安> 검색중인 웹 페이지는 삭제되었거나 이름이 변경되었거나 일시적으로 사용할 수 없습니다. </font> </td>
- </tr>
- <tr>
- <tdwidth = 400colspan = 2> <fontstyle = color : 000000; font : 9pt/11pt 安安>
- <hrcolor =#c0c0c0noshade>
- <p> 다음을 시도하십시오 : </p>
- <ul>
- <li> 주소 표시 줄에서 웹 주소를 입력 한 경우 올바르게 철자가 있는지 확인하십시오. <br>
- </li>
- <li> <li> <cript>
- <!-
- if (! (!
- {
- 홈페이지 ();
- }
- //->
- </script> 홈페이지, 필요한 정보에 대한 링크를 찾으십시오. </li>
- <li> <ahref = javaScript : history.back (1)> back </a> 버튼을 클릭하여 다른 링크를 시도하십시오. </li>
- </ul>
- <h2style = font : 9pt/11pt 安安; color : 000000> http404-file을 찾을 수 없습니다 <br> 인터넷 정보 서비스 <br> </h2>
- <hrcolor =#c0c0c0noshade>
- <p> 기술 정보 (지원 개인) </p>
- <ul>
- <li> 세부 사항 : <br> <ahref = http : //www.microsoft.com/contentredirect.asp? prd = iis & sbp = & pver = 5.0 & pid = & id = 404 & cat = web & os = & hrd = & opt1 = & opt2 = & opt3 = 대상 = _blank> Microsoft 지원 </a>
- </li>
- </ul>
- </font> </td>
- </tr>
- </테이블>
- </body>
- </html>
위의 것은 ASP 오류 객체에 대한 간단한 분석이며 모든 사람의 학습에 도움이되기를 바랍니다.