ASP應(yīng)用進(jìn)階 ASP Error對(duì)象的相關(guān)知識(shí)(2)_ASP教程
推薦:實(shí)例詳解ASP中斷開(kāi)記錄集的使用方法我們?cè)谑褂肁SP 內(nèi)置的ADO組件進(jìn)行數(shù)據(jù)庫(kù)編程時(shí),通常是在腳本的開(kāi)頭打開(kāi)一個(gè)連接,并在腳本的最后關(guān)閉它,但是就較大腳本而言,在多數(shù)情況下連接打開(kāi)的時(shí)間要比它需要打開(kāi)的時(shí)間長(zhǎng)得多。因此為
Column:整型。產(chǎn)生錯(cuò)誤的文件中的字符位置
Description:字符串型。錯(cuò)誤的簡(jiǎn)短說(shuō)明
File:字符串型。錯(cuò)誤出現(xiàn)時(shí)正在處理的文件的名稱(chēng)
Line:整型。產(chǎn)生錯(cuò)誤的文件中的行號(hào)
Number:整型。一個(gè)標(biāo)準(zhǔn)的COM錯(cuò)誤代碼
Source:字符串型。引發(fā)錯(cuò)誤的行的實(shí)際代碼
ok,這就是9個(gè)屬性,使用asperror對(duì)象的語(yǔ)法是:
asperror.property
就是這樣:ASPError.ASPCode()
ASPError.ASPDescription()
ASPError.Category()
ASPError.Column()
ASPError.Description()
ASPError.File()
ASPError.Line()
ASPError.Number()
ASPError.Source()
在iis支持的所有目錄下面(或:在編輯了錯(cuò)誤映射屬性的目錄內(nèi))的任一頁(yè)面上出現(xiàn)一個(gè)與ASP相關(guān)的錯(cuò)誤時(shí),都將載入定制錯(cuò)誤頁(yè)面。實(shí)際上,現(xiàn)在已經(jīng)設(shè)置了一個(gè)正常的腳本錯(cuò)誤陷阱,因?yàn)樵谶@個(gè)目錄內(nèi)的任何一個(gè)網(wǎng)頁(yè)上的ASP運(yùn)行期錯(cuò)誤都將觸發(fā)定制錯(cuò)誤頁(yè)面,錯(cuò)誤網(wǎng)頁(yè)作為IIS的缺省安裝部分,可根據(jù)個(gè)人情況定制.例如,當(dāng)我們?cè)谝粋(gè)目錄下面輸入不存在的網(wǎng)頁(yè)時(shí),出現(xiàn)404錯(cuò)誤,當(dāng)一個(gè)404錯(cuò)誤出現(xiàn)時(shí),使用的頁(yè)面是404b.htm,這個(gè)文件包含一個(gè)客戶端腳本代碼部分,它獲得當(dāng)前文檔的URL(從document對(duì)象的url屬性中檢索)并在該頁(yè)面中顯示:
| <!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML3.2Final//EN"> <htmldir=ltr> <head> <style>a:link{font:9pt/11pt宋體;color:FF0000}a:visited{font:9pt/11pt宋體;color:#4e4e4e} </style> <METANAME="ROBOTS"CONTENT="NOINDEX"> <title>無(wú)法找到網(wǎng)頁(yè)</title> <METAHTTP-EQUIV="Content-Type"Content="text-html;charset=gb2312"> <METANAME="MS.LOCALE"CONTENT="ZH-CN"> </head> <script> functionHomepage(){ <!-- //inrealbits,urlsgetreturnedtoourscriptlikethis: //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); //thisfindstheendingslashforthedomainserver serverIndex=DocURL.indexOf("/",protocolIndex 3); //forthehref,weneedavalidURLtothedomain.Wesearchforthe#symboltofindthebegining //ofthetrueURL,andadd1toskipit-thisistheBeginURLvalue.WeuseserverIndexastheendmarker. //urlresult=DocURL.substring(protocolIndex-4,serverIndex); BeginURL=DocURL.indexOf("#",1) 1; urlresult=DocURL.substring(BeginURL,serverIndex); //fordisplay,weneedtoskipafterhttp://,andgotothenextslash displayresult=DocURL.substring(protocolIndex 3,serverIndex); InsertElementAnchor(urlresult,displayresult); } functionHtmlEncode(text) { returntext.replace(/&/g,'&').replace(/'/g,'"').replace(/</g,'<').replace(/>/g,'>'); } functionTagAttrib(name,value) { return'' name '="' HtmlEncode(value) '"'; } functionPrintTag(tagName,needCloseTag,attrib,inner){ document.write('<' tagName attrib '>' HtmlEncode(inner)); if(needCloseTag)document.write('</' tagName '>'); } functionURI(href) { IEVer=window.navigator.appVersion; IEVer=IEVer.substr(IEVer.indexOf('MSIE') 5,3); return(IEVer.charAt(1)=='.'&&IEVer>='5.5')? encodeURI(href): escape(href).replace(/:/g,':').replace(/;/g,';'); } functionInsertElementAnchor(href,text) { PrintTag('A',true,TagAttrib('HREF',URI(href)),text); } //--> </script> <bodybgcolor="FFFFFF"> <tablewidth="410"cellpadding="3"cellspacing="5"> <tr> <tdalign="left"valign="middle"width="360"> <h1style="COLOR:000000;FONT:12pt/15pt宋體"><!--Problem-->無(wú)法找到網(wǎng)頁(yè)</h1> </td> </tr> <tr> <tdwidth="400"colspan="2"><fontstyle="COLOR:000000;FONT:9pt/11pt宋體">您正在搜索的網(wǎng)頁(yè)可能已經(jīng)刪除、更名或暫時(shí)不可用。</font></td> </tr> <tr> <tdwidth="400"colspan="2"><fontstyle="COLOR:000000;FONT:9pt/11pt宋體"> <hrcolor="#C0C0C0"noshade> <p>請(qǐng)嘗試下列操作:</p> <ul> <li>如果您在“地址”欄中鍵入了網(wǎng)頁(yè)地址,請(qǐng)檢查其拼寫(xiě)是否正確。<br> </li> <li>打開(kāi)<script> <!-- if(!((window.navigator.userAgent.indexOf("MSIE")>0)&&(window.navigator.appVersion.charAt(0)=="2"))) { Homepage(); } //--> </script>主頁(yè),尋找指向所需信息的鏈接。</li> <li>單擊<ahref="javascript:history.back(1)">后退</a>按鈕嘗試其他鏈接。</li> </ul> <h2style="font:9pt/11pt宋體;color:000000">HTTP404-無(wú)法找到文件<br>Internet信息服務(wù)<BR></h2> <hrcolor="#C0C0C0"noshade> <p>技術(shù)信息(支持個(gè)人)</p> <ul> <li>詳細(xì)信息:<br><ahref="http://www.microsoft.com/ContentRedirect.asp?prd=iis&sbp=&pver=5.0&pid=&ID=404&cat=web&os=&over=&hrd=&Opt1=&Opt2=&Opt3="target="_blank">Microsoft支持</a> </li> </ul> </font></td> </tr> </table> </body> </html> |
分享:請(qǐng)注意!常見(jiàn)的ASP腳本攻擊及防范技巧由于ASP的方便易用,越來(lái)越多的網(wǎng)站后臺(tái)程序都使用ASP腳本語(yǔ)言。但是, 由于ASP本身存在一些安全漏洞,稍不小心就會(huì)給黑客提供可乘之機(jī)。事實(shí)上,安全不僅是網(wǎng)管的事,編程人員也必須在某些安全
- asp FSO 讀寫(xiě)文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫(kù)實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過(guò)濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁(yè)模板:ASP內(nèi)建對(duì)象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無(wú)組件分頁(yè)實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
復(fù)制本頁(yè)鏈接| 搜索ASP應(yīng)用進(jìn)階 ASP Error對(duì)象的相關(guān)知識(shí)(2)
- 教程說(shuō)明:
ASP教程-ASP應(yīng)用進(jìn)階 ASP Error對(duì)象的相關(guān)知識(shí)(2)
。