Active Server Page (ASP) 常見問題

来源:互联网 发布:大众变速箱电脑编程 编辑:程序博客网 时间:2024/05/21 19:41

       Active Server Page (ASP) 常見問題

【「Active Server Page」以下簡稱「ASP」】
問: 如何將認證使用者儲存到Session變數(New) 問: ServerVariables("LOGON_USER")傳回空值(New) 問: ServerVariables("Remote_Host")傳回IP而不是HostName(New) 問: CDO版本摘要介紹 問: 何謂ADSI 問: 何謂ADsPath? 問: 如何得到LDAP Root DS Entry 問: 如何偵測瀏覽器的屬性? 問: 如何善用Response.Buffer增進瀏覽速度? 問: 如何利用Meta Tag來增加文件屬性? 問: Server.TransferResponse.Redirect相異之處? 問: Server.Execute#include相異之處? 問: 要如何使用ASPError物件? 問: 要如何讓以asp程式讓Internet Explorer 瀏覽器不cache 問: 如何依據瀏覽器語言版本設定ASP locale ID ? 問: 如何使用ASP/ADO query ODBC DATASOURCE 問: 要如何使用 Active Server Pages 程式預防瀏覽器開啟檔案時只顯示為Frameset的一部份? 問:

如何使用ASP 製作模擬動態生長的表單(form) ?

問: 如何使用ASP利用ADO呼叫SQLstored procedure 問: 我的程式中是否能放入Option Explicit?
Option Explicit
Response.Expires = 0
問: 如何在ASP程式中設定session timeout的長短? 問: 如果使用者不接受cookie會發生何種狀況? 問: 要如何設定ASPcache 問: 當使用了Proxy Server的情況下,Webpage回傳一個"Object Moved"的錯誤,要如何修改
asp程式解決這個問題? 問:
什麼時候增加ASP script engine cache,可以幫助運行的效率? 問: 使用 On filesystemobject.filecopy 方法,得到以下錯誤訊息,應該如何處理?

Microsoft VBScript runtime error '800a0046'
Permission denied

問:
如何設計一個page可以對每個登入的使用者提示歡迎的祝賀語如下?

Welcome <NT Username>

問:
是否有可能去讀取以及解析在其他site的檔案而無須附加其他的元件? 問: access自己web site 下的virtual directory ,會發生以下的錯誤訊息,該如何處理?

HTTP/1.1 500 Server Error -2146646015 (0x800cc801)

問:
為何IISOnline文件的Index tab沒有包含所有的章節? 問: 為何無法在PWS 或是NT Workstation 版的IIS上做搜尋文件? 問: 為何當disable 自動密碼同步後,匿名使用者無法進入web site 問: ASP 1.0有哪幾個版本? 問: 發生以下的錯誤是什麼原因?

Microsoft VBScript compilation error '800a0414'
Cannot use parens when calling a Sub
/test/test.asp, line 17
myobj.movefile(fname, sfolder, tfolder)
---------------------------------------^

問:
要如何強迫 session 關閉? 問: 發生以下的錯誤是什麼原因,要如何解決?

error 'ASP 0115' Unexpected error
/disney/main.asp
A trappable error occurred in an external object. The script cannot continue running.

問: 為何會發生"HTTP Headers already written" 的錯誤? 問:
使用以Microsoft Visual C++ 寫的 server-side 元件如何除錯? 問: 當更新了在 wwwroot 目錄下的檔案,可是一定要重新啟動web server才能看到這些檔案被更新,是否由caching 所造成的問題? 問: Internet Information Server (IIS) 如何得知要將.asp 檔案傳遞到 Microsoft Active Server Pages (ASP)? 問: 為何會發生奇怪的錯誤當使用CreateObject 存取元件? 問: 要如何設定Microsoft Internet Information Server (IIS) 讓預設網頁為default.asp 檔案? 問: 當將一個.asp檔案放到web server上,當由瀏覽器讀取這個.asp檔案時卻可以看到整個.asp程式碼,有什麼不對呢? 問: 哪些作業系統支援執行ASP 問: 是否能夠從一支asp程式呼叫在另一支asp程式的副程式或函數? 問: 是否能夠從一支asp程式存取在另一支asp程式的變數? 問: VBScript 是否在Response.Redirect執行後執行? 問: VBScript 是否在Response.End執行後執行? 問: 什麼原因會產生錯誤訊息如下?
Response object error 'ASP 0156' Header Error
/intranet_devel/scripts/CheckLog.asp, line 14
The HTTP headers are already written to the client
browser. Any HTTP header modifications must be made before writing page content.
問:
Session變數是否能使用在web farm? 問: 什麼原因會產生錯誤訊息如下?
'ASP 0113'The max amount of time for a script to execute was
exceed, you can change this limit by specifying a
new value for the property server. Script Time out
or by changing the value for Script Time out.
問:
什麼原因會產生錯誤訊息如下?
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][dbnmpntw]ConnectionOpen (CreateFile()).
問:
什麼原因會產生錯誤訊息如下?
Server object error 'ASP 0177:80040112'
Server.CreateObject Failed [Filename], line [line number]
The call to Server.CreateObject failed. The requested object instance cannot be created.
問:
什麼原因會產生錯誤訊息如下?
Microsoft VBScript runtime error '800a000d'
Type mismatch
問:
什麼原因會產生錯誤訊息如下?
Error ASP 0115 unexpected error.
Trappable error occured in an external object, the script cannot continue running.
問:
什麼原因會產生錯誤訊息如下?
Server object error 'ASP 177:800401f3'Server.CreateObject Failed
/aspsamp/tutorial/lessons/Finance.asp, line 52
The call to Server.CreateObject failed. The requested object instance cannot be created.
問:
什麼原因會產生錯誤訊息如下?
Server object error 'ASP 0177:80040154 'Server.createobject failed
/advworks/equipment/equip.asp, line 2
The call to server.createobject failed The requeted object instance can not be created.
問:
由於cookie的生命週期僅發生在目前的IE session,如果結束IE並且重新啟動IE ,這時 cookie就消逝了,應如何控制cookie的使用期限? 問: 如何由client端得知螢幕解析度?

問: 如何將認證使用者儲存到Session變數(New) 答: <%
If Session("LOGON_USER") = "" Then
If Request.ServerVariables("LOGON_USER") = "" Then
  Response.Status = "401 Access Denied"
  Response.End
Else
  Session("LOGON_USER") = Request.ServerVariables("LOGON_USER")
  ' the following lines strip out an NT domain from the user name
  If InStr(Session("LOGON_USER"),"/") then
    Session("LOGON_USER") = Right(Session("LOGON_USER"), Len(Session("LOGON_USER")) - InStr(Session("LOGON_USER"),"/"))
  End If
End If
End If
%>
問: ServerVariables("LOGON_USER")傳回空值(New) 答: 如果ASP page使用"允許匿名存取",則"LOGON_USER"variable將會傳回空值。如果要正確顯示請將認證模式設為基本驗證或整合Windows驗證即可。 問: ServerVariables("Remote_Host")傳回IP而不是HostName(New) 答: 在預設情況下,ServerVariables("Remote_Host")傳回IP,這是設計上的考量,為了要增進IIS的效能,但您仍可藉由修改Metabase,叫IIS去跟DNS做查詢,詳細請見KB Q245574。 問: CDO版本摘要介紹 答: Library 來源 檔名 ProgID CDO 1.0 Exchange 4.0 Mdlsp.dll
Mdlsp32.dll
MAPI CDO 1.1 Exchange 5.0 OleMsg.dll
OleMsg32.dll
MAPI CDO 1.2 Exchange 5.5
Outlook 98
Outlook 2000
Exchange 2000
Cdo.dll  MAPI CDO for NTS 1.2 Exchange 5.5
IIS 4.0
MCIS
Windows 2000
CdoNTS.dll  CDONTS CDO for Windows 2000 (CDO 2.0) Windows 2000 Cdosys.dll CDO CDO for Exchange 2000 (CDO 3.0) Exchange 2000 Cdoex.dll CDO CDO for Exchange Management 1.0 Exchange 2000 Cdoexm.dll CDOEXM CDO WorkFlow Objects for Microsoft Exchange 1.0 Exchange 2000 Cdowf.dll CDOWF
問: 何謂ADSI 答: ADSI是一組存取不同目錄服務的介面,這裡將會專注在存取Windows 2000 Active Directory directory service. ADSI使用LDAP協定來跟Active Directory溝通。 問: 何謂ADsPath? 答: 當使用程式存取Active Directory時,你必須提供LDAP namespace(progID)和物件的路徑(ADsPath),以下是一些ADsPath的範例:
ADSI object ADsPath Organizational unit in the nwtraders domain LDAP://OU=Sales, DC=nwtraders, DC=msft Exchange object on Exchange Server LDAP://exch01/O=Microsoft jsmith user in the Sales OU of the nwtraders domain LDAP://CN=jsmith, OU=Sales, DC=nwtraders, DC=msft comp1 in the Redmond domain WinNT://REDMOND/comp1, computer alice, a local user on the comp1 computer WinNT://REDMOND/comp1/alice
問: 如何得到LDAP Root DS Entry 答: RFC 2251 中規範所有的LDAP directory都必須擁有一個特別內容rootDSE object,其中一個標準的屬性叫做defaultNamingContext,在Windows 2000 中,他會回傳Active Directory根目錄的名稱,請見以下範例:
Set Root = GetObject("LDAP://RootDSE")
DomainPath = Root.Get("DefaultNamingContext")
Set Domain = GetObject("LDAP://"& DomainPath)
問: 如何偵測瀏覽器的屬性? 答: 利用MSWC.BrowserType可以偵測到瀏覽器許多屬性,如瀏覽器名稱、版本,是否支援cookies、frames、tables、BackGroundSounds、VBScript、JavaScript等。例如: Set bc = Server.CreateObject("MSWC.BrowserType")
if bc.cookies=True then...
問: 如何利用Response.Buffer增進瀏覽速度? 答: 利用Response.Buffer=True,Response.Flush可以增進使用者瀏覽速度,如果一個頁面 Response.Buffer=False,有30個資料傳輸,若有100個人瀏覽此頁面,則有 3000個來回傳輸,嚴重影響效率;若在起始處設定 Response.Buffer=True,再將整個頁面分為幾個群組,在設當的地方搭配 Response.Flush,則可大幅改善使用者經驗。 問: 如何利用Meta Tag來增加文件屬性? 答: Meta Tag 中記錄著各種要提供給瀏覽器的隱藏資訊或指示,如
<META NAME="Update" CONTENT="2000/9/7">
<META NAME="Author" CONTENT="Jerry">
<META NAME="KeyWords" CONTENT="ASP">
<META NAME="Description" CONTENT="VID/ASP FAQ">
如此可讓搜尋引擎或Web Crawler自動進行讀取。
問: Server.TransferResponse.Redirect相異之處? 答: 雖然Server.TransferResponse.Redirect都會轉向,但兩者之間仍有些不同:
Response.Redirect是先由伺服器端將資料送到用戶端,用戶端再依照Redirect內容,向伺服器端要求轉向到另一個網頁,如此會增加一次用戶端與伺服器端來回通訊時間,而Server.Transfer則是在伺服器端直接轉向到另一個網頁。並且由於Server.Transfer轉向前後的網頁,仍屬同一應用程式,因此會將SessionApplication的變數值帶到轉向後的URL位置,而Response.Redirect不會。
問: Server.Execute#include相異之處? 答: Execute Method 是呼叫一個.asp 檔案並執行它,比較類似一般程式語言的procedure call;而#include則僅將所包含的程式插入原程式當中。 問: 要如何使用ASPError物件? 答: 首先由Set objASPError=Server.GetLastError取得錯誤資訊,接著由ASPError物件的屬性取得相關訊息:
objASPError.ASPCode:傳回IIS產生的錯誤碼
objASPError.Number:傳回COM標準錯誤碼,如 0x800A03FC
objASPError.Source:傳回實際產生錯誤的原始碼
objASPError.Category:指出錯誤的來源為ASPScript或是Object
objASPError.File:傳回錯誤程式檔案名稱
objASPError.Line:傳回錯誤程式碼的行數
objASPError.Column:傳回錯誤程式碼的列數
objASPError.Description:傳回錯誤原因簡介
objASPError.ASPDescription:傳回詳細錯誤原因
問: 要如何讓以asp程式讓Internet Explorer 瀏覽器不cache 答: 除了由IIS可設定讓Internet Explorercache以外,可以用以下的asp script,基本上是使用HTTP header控制cache
以下
script必須執行在HTTP 1.1 server ,適用於Internet Explorer 4.0以上版本。

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>
問: 如何依據瀏覽器語言版本設定ASP locale ID ? 答: 使用以下的副程式就是依據使用者的瀏覽器語言,動態設定ASP應用程式 Locale ID
(Session.LCID)

<SCRIPT Runat=Server Language=VBScript>
Sub SetLCID()
Dim strAcceptLanguage
Dim strLCID
Dim strPos

strAcceptLanguage = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")

strPos = InStr(1, strAcceptLanguage, ",")
If strPos > 0 Then
strAcceptLanguage = Left(strAcceptLanguage, strPos - 1)
End If

Select Case LCase(strAcceptLanguage)
Case "af"
strLCID = 1078 ' Afrikaans
Case "sq"
strLCID = 1052 ' Albanian
Case "ar-sa"
strLCID = 1025 ' Arabic(Saudi Arabia)
Case "ar-iq"
strLCID = 2049 ' Arabic(Iraq)
Case "ar-eg"
strLCID = 3073 ' Arabic(Egypt)
Case "ar-ly"
strLCID = 4097 ' Arabic(Libya)
Case "ar-dz"
strLCID = 5121 ' Arabic(Algeria)
Case "ar-ma"
strLCID = 6145 ' Arabic(Morocco)
Case "ar-tn"
strLCID = 7169 ' Arabic(Tunisia)
Case "ar-om"
strLCID = 8193 ' Arabic(Oman)
Case "ar-ye"
strLCID = 9217 ' Arabic(Yemen)
Case "ar-sy"
strLCID = 10241 ' Arabic(Syria)
Case "ar-jo"
strLCID = 11265 ' Arabic(Jordan)
Case "ar-lb"
strLCID = 12289 ' Arabic(Lebanon)
Case "ar-kw"
strLCID = 13313 ' Arabic(Kuwait)
Case "ar-ae"
strLCID = 14337 ' Arabic(U.A.E.)
Case "ar-bh"
strLCID = 15361 ' Arabic(Bahrain)
Case "ar-qa"
strLCID = 16385 ' Arabic(Qatar)
Case "eu"
strLCID = 1069 ' Basque
Case "bg"
strLCID = 1026 ' Bulgarian
Case "be"
strLCID = 1059 ' Belarusian
Case "ca"
strLCID = 1027 ' Catalan
Case "zh-tw"
strLCID = 1028 ' Chinese(Taiwan)
Case "zh-cn"
strLCID = 2052 ' Chinese(PRC)
Case "zh-hk"
strLCID = 3076 ' Chinese(Hong Kong)
Case "zh-sg"
strLCID = 4100 ' Chinese(Singapore)
Case "hr"
strLCID = 1050 ' Croatian
Case "cs"
strLCID = 1029 ' Czech
Case "da"
strLCID = 1030 ' Danish
Case "n"
strLCID = 1043 ' Dutch(Standard)
Case "nl-be"
strLCID = 2067 ' Dutch(Belgian)
Case "en"
strLCID = 9 ' English
Case "en-us"
strLCID = 1033 ' English(United States)
Case "en-gb"
strLCID = 2057 ' English(British)
Case "en-au"
strLCID = 3081 ' English(Australian)
Case "en-ca"
strLCID = 4105 ' English(Canadian)
Case "en-nz"
strLCID = 5129 ' English(New Zealand)
Case "en-ie"
strLCID = 6153 ' English(Ireland)
Case "en-za"
strLCID = 7177 ' English(South Africa)
Case "en-jm"
strLCID = 8201 ' English(Jamaica)
Case "en"
strLCID = 9225 ' English(Caribbean)
Case "en-bz"
strLCID = 10249 ' English(Belize)
Case "en-tt"
strLCID = 11273 ' English(Trinidad)
Case "et"
strLCID = 1061 ' Estonian
Case "fo"
strLCID = 1080 ' Faeroese
Case "fa"
strLCID = 1065 ' Farsi
Case "fi"
strLCID = 1035 ' Finnish
Case "fr"
strLCID = 1036 ' French(Standard)
Case "fr-be"
strLCID = 2060 ' French(Belgian)
Case "fr-ca"
strLCID = 3084 ' French(Canadian)
Case "fr-ch"
strLCID = 4108 ' French(Swiss)
Case "fr-lu"
strLCID = 5132 ' French(Luxembourg)
Case "gd"
strLCID = 1084 ' Gaelic(Scots)
Case "gd-ie"
strLCID = 2108 ' Gaelic(Irish)
Case "de"
strLCID = 1031 ' German(Standard)
Case "de-ch"
strLCID = 2055 ' German(Swiss)
Case "de-at"
strLCID = 3079 ' German(Austrian)
Case "de-lu"
strLCID = 4103 ' German(Luxembourg)
Case "de-li"
strLCID = 5127 ' German(Liechtenstein)
Case "e"
strLCID = 1032 ' Greek
Case "he"
strLCID = 1037 ' Hebrew
Case "hi"
strLCID = 1081 ' Hindi
Case "hu"
strLCID = 1038 ' Hungarian
Case "is"
strLCID = 1039 ' Icelandic
Case "in"
strLCID = 1057 ' Indonesian
Case "it"
strLCID = 1040 ' Italian(Standard)
Case "it-ch"
strLCID = 2064 ' Italian(Swiss)
Case "ja"
strLCID = 1041 ' Japanese
Case "ko"
strLCID = 1042 ' Korean
Case "ko"
strLCID = 2066 ' Korean(Johab)
Case "lv"
strLCID = 1062 ' Latvian
Case "lt"
strLCID = 1063 ' Lithuanian
Case "mk"
strLCID = 1071 ' Macedonian
Case "ms"
strLCID = 1086 ' Malaysian
Case "mt"
strLCID = 1082 ' Maltese
Case "no"
strLCID = 1044 ' Norwegian(Bokmal)
Case "no"
strLCID = 2068 ' Norwegian(Nynorsk)
Case "p"
strLCID = 1045 ' Polish
Case "pt-br"
strLCID = 1046 ' Portuguese(Brazilian)
Case "pt"
strLCID = 2070 ' Portuguese(Standard)
Case "rm"
strLCID = 1047 ' Rhaeto-Romanic
Case "ro"
strLCID = 1048 ' Romanian
Case "ro-mo"
strLCID = 2072 ' Romanian(Moldavia)
Case "ru"
strLCID = 1049 ' Russian
Case "ru-mo"
strLCID = 2073 ' Russian(Moldavia)
Case "sz"
strLCID = 1083 ' Sami(Lappish)
Case "sr"
strLCID = 3098 ' Serbian(Cyrillic)
Case "sr"
strLCID = 2074 ' Serbian(Latin)
Case "sk"
strLCID = 1051 ' Slovak
Case "s"
strLCID = 1060 ' Slovenian
Case "sb"
strLCID = 1070 ' Sorbian
Case "es"
strLCID = 1034 ' Spanish(Spain - Traditional Sort)
Case "es-mx"
strLCID = 2058 ' Spanish(Mexican)
Case "es"
strLCID = 3082 ' Spanish(Spain - Modern Sort)
Case "es-gt"
strLCID = 4106 ' Spanish(Guatemala)
Case "es-cr"
strLCID = 5130 ' Spanish(Costa Rica)
Case "es-pa"
strLCID = 6154 ' Spanish(Panama)
Case "es-do"
strLCID = 7178 ' Spanish(Dominican Republic)
Case "es-ve"
strLCID = 8202 ' Spanish(Venezuela)
Case "es-co"
strLCID = 9226 ' Spanish(Colombia)
Case "es-pe"
strLCID = 10250 ' Spanish(Peru)
Case "es-ar"
strLCID = 11274 ' Spanish(Argentina)
Case "es-ec"
strLCID = 12298 ' Spanish(Ecuador)
Case "es-c"
strLCID = 13322 ' Spanish(Chile)
Case "es-uy"
strLCID = 14346 ' Spanish(Uruguay)
Case "es-py"
strLCID = 15370 ' Spanish(Paraguay)
Case "es-bo"
strLCID = 16394 ' Spanish(Bolivia)
Case "es-sv"
strLCID = 17418 ' Spanish(El Salvador)
Case "es-hn"
strLCID = 18442 ' Spanish(Honduras)
Case "es-ni"
strLCID = 19466 ' Spanish(Nicaragua)
Case "es-pr"
strLCID = 20490 ' Spanish(Puerto Rico)
Case "sx"
strLCID = 1072 ' Sutu
Case "sv"
strLCID = 1053 ' Swedish
Case "sv-fi"
strLCID = 2077 ' Swedish(Finland)
Case "th"
strLCID = 1054 ' Thai
Case "ts"
strLCID = 1073 ' Tsonga
Case "tn"
strLCID = 1074 ' Tswana
Case "tr"
strLCID = 1055 ' Turkish
Case "uk"
strLCID = 1058 ' Ukrainian
Case "ur"
strLCID = 1056 ' Urdu
Case "ve"
strLCID = 1075 ' Venda
Case "vi"
strLCID = 1066 ' Vietnamese
Case "xh"
strLCID = 1076 ' Xhosa
Case "ji"
strLCID = 1085 ' Yiddish
Case "zu"
strLCID = 1077 ' Zulu
Case Else
strLCID = 2048 ' default
End Select

Session.LCID = strLCID
End Sub
</SCRIPT>

Sample ASP Page
---------------

以下的asp程式展示Locale 的變換,請在瀏覽器中的Internet 選項,改變語言設定。再refresh 這個 ASP page

NOTE: The SetLCID() 副程式請include在檔案setlcid.inc.

<%@ Language=VBScript %>
<HTML>
<BODY>

<!--#include file=setlcid.inc -->

<%
SetLCID 'Set the Locale ID per the browser

Response.Write "Date/Time Formats"
Response.Write "<p>Date = " & Date()
Response.Write "<br>Month = " & Month(Date())
Response.Write "<br>Day = " & Day(Date())
Response.Write "<br>Year = " & Year(Date())
Response.Write "<br>Time = " & Time()

Response.Write "<p>Currency Formats"
Response.Write "<p>" & FormatCurrency(1.05, 2)
Response.Write "<br>" & FormatNumber(1000000,2)
Response.Write "<br>" & FormatNumber(-1000000,2)

%>
</BODY>
</HTML>

問: 如何使用ASP/ADO query ODBC DATASOURCE 答: 以下的example僅做測試目的,測試 ADO 連接到任何 ODBC Datasource
<HTML>
<%
if Request("REQUESTTYPE") <> "POST" then
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
如果request 不包含 REQUESTTYPE = "POST
' %
則顯示 Form Page
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dsn = Session("dsn")
dbuser = Session("dbuser")
dbpass = Session("dbpass")
dbtable = Session("dbtable")
dbfield = Session("dbfield")
dbwhere = Session("dbwhere")
%>
<FORM ACTION=adoselect.asp method=POST>
<TABLE>
<TR><TD><B>You are authenticated as: </TD>
<TD><FONT COLOR=GREEN><% =
Request.ServerVariables("LOGON_USER")%></TD></TR>
<TR><TD><B>Your IP Address is: </TD>
<TD><FONT COLOR=GREEN><% =
Request.ServerVariables("REMOTE_ADDR")%></TD></TR>
<TR><TD><B>System DSN:</TD>
<TD><INPUT TYPE=TEXT NAME=datasource VALUE="<% = dsn %>"></TD></TR>
<TR><TD><B>Username:</TD>
<TD><INPUT TYPE=TEXT NAME=username VALUE="<% = dbuser %>"></TD></TR>
<TR><TD><B>Password:</TD>
<TD><INPUT TYPE=Password NAME=password VALUE="<% = dbpass
%>"></TD></TR>
<TR><TD><B>Table:</TD>
<TD><INPUT TYPE=TEXT NAME=table VALUE="<% = dbtable %>"></TD></TR>
<TR><TD><B><FONT COLOR=RED>WHERE</TD>
<TD></TD></TR>
<TR><TD><B>Field to Query:</TD>
<TD><INPUT TYPE=TEXT NAME=field VALUE="<% = dbfield %>"></TD></TR>
<TR><TD><B>Value to Query:</TD>
<TD><INPUT TYPE=TEXT NAME=where VALUE="<% = dbwhere %>"></TD></TR>
</TABLE>
<INPUT TYPE=HIDDEN NAME=REQUESTTYPE VALUE="POST">
<INPUT TYPE=Submit VALUE="Query Database">
<HR>
</FORM>
<%

else
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'%
執行 Query to Database
'%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Request datsource
從之前的Form
' %
設定 Session 變數因此可以讀取這個值作為下次查詢使用
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dsn = Request("datasource")
Session("dsn") = dsn

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Request username
從之前的Form
' %
設定 Session 變數因此可以讀取這個值作為下次查詢使用
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dbuser = Request("username")
Session("dbuser") = dbuser

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Request password
從之前的Form
' %
設定 Session 變數因此可以讀取這個值作為下次查詢使用
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dbpass = Request("password")
Session("dbpass") = dbpass

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Request table
從之前的Form
' %
設定 Session 變數因此可以讀取這個值作為下次查詢使用
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dbtable = Request("table")
Session("dbtable") = dbtable

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Request field
從之前的Form
' %
設定 Session 變數因此可以讀取這個值作為下次查詢使用
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dbfield = Request("field")
Session("dbfield") = dbfield

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' % Request table
從之前的Form
' %
設定 Session 變數因此可以讀取這個值作為下次查詢使用
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

dbwhere = Request("where")
Session("dbwhere") = dbwhere

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
檢查是否有任何要求的變數是blank, 如果有會通知使用者何者
' % blank ,反之繼續query
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if dsn = "" OR dbuser = "" OR dbtable = "" then

Response.write "Error in SQL Statement:<BR>"
if dsn = "" then
Response.write "<FONT COLOR=RED>Missing System DSN</FONT><P>"
end if
if dbuser = "" then
Response.write "<FONT COLOR=RED>Missing Username</FONT><P>"
end if
if dbtable = "" then
Response.write "<FONT COLOR=RED>Missing Tablename</FONT><P>"
end if
Response.write "<FORM ACTION=adoselect.asp><INPUT TYPE=SUBMIT
VALUE=ReQuery></FORM>"
else
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
產生 Conn Object ,開啟時
' % 帶進參數 System DSN, UserID, Password
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Set Conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.RecordSet")
Conn.Open dsn, dbuser, dbpass

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
建立 SQL 敘述並指定到變數 sql.
' $
連接 dbtable 以及SELECT 敘述
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if dbfield = "" OR dbwhere ="" then
sql="SELECT * FROM " & dbtable
else

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
如果 dbfield dbwhere 被定,接著
' % 改變SQL 敘述使用 WHERE 子句
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
'
sql="SELECT * FROM " & dbtable
sql = sql & " WHERE " & dbfield
sql = sql & " LIKE '%" & dbwhere & "%'"
end if

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
除錯用, 回傳 SQL 敘述
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Response.Write "<B><FONT SIZE=2 COLOR=BLUE>SQL STATEMENT: </B>" &
sql & "<HR>"

' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
開啟 RecordSet (RS) 並傳到
' % connection (conn) SQL 敘述 (sql)
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RS.Open sql, Conn
%>

<P>
<TABLE BORDER=1>
<TR>
<%
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
迴圈從 Fields Names ,印出 Field Names
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

For i = 0 to RS.Fields.Count - 1
%>
<TD><B><% = RS(i).Name %></B></TD>
<% Next %>
</TR>
<%
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
迴圈從 rows, 顯示每一個field
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Do While Not RS.EOF
%>
<TR>
<% For i = 0 to RS.Fields.Count - 1 %>
<TD VALIGN=TOP><% = RS(i) %></TD>
<% Next %>
</TR>
<%
RS.MoveNext
Loop
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
' %
確認關閉 Result Set 以及 Connection object
' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RS.Close
Conn.Close
%>
</TABLE>

<%
end if
end if
%>

問: 要如何使用 Active Server Pages 程式預防瀏覽器開啟檔案時只顯示為Frameset的一部份? 答: Web 文件變成frameset的一部份的情形發生,通常是由於不是設計成個別顯示,要預防這個情形,可使用ASP "Response.Redirect" "Request.ServerVariables" 方重新指向到frameset page

假設使用以下文件架構:

Frameset Page (mainfrm.htm)
Frame 1 (frame1.asp)
Frame 2 (frame2.asp)

將以下的程式碼放在frame1.asp 或是 frame2.asp 在開頭的<HTML> tag 之前

<%
If (Request.ServerVariables("HTTP_REFERER") = "") Or _
(Left(Request.ServerVariables("HTTP_REFERER"),42) <> _
"http://www.myserver.com/AppDir/mainfrm.htm") Then
Response.Redirect "http://www.myserver.com/AppDir/mainfrm.htm"
End If
%>

以下是這個例子的程式碼

File: Mainfrm.htm
-----------------

<HTML>
<HEAD><TITLE>MAINFRM</TITLE></HEAD>
<BODY>
<FRAMESET ROWS="400,*">
<FRAME SCROLLING="no" NORESIZE SRC="frame1.asp">
<FRAME SCROLLING="no" NORESIZE SRC="frame2.asp">
</FRAMESET>
</BODY>
</HTML>

File: Frame1.asp
----------------

<%
If (Request.ServerVariables("HTTP_REFERER") = "") Or
(Left(Request.ServerVariables("HTTP_REFERER"),42) <>
"http://www.myserver.com/AppDir/mainfrm.htm") Then
Response.Redirect "http://www.myserver.com/AppDir/mainfrm.htm"
End If
%>

<HTML>
<HEAD><TITLE>FRAME1</TITLE></HEAD>
<BODY>
In Frame 1.
</BODY>
</HTML>

File: Frame2.asp
----------------

<HTML>
<HEAD><TITLE>FRAME2</TITLE></HEAD>
<BODY>
In Frame 2.
</BODY>
</HTML>

問: 如何使用ASP 製作模擬動態生長的表單(form) ? 答: FILE: DYNAFORM.ASP
<%@ language = vbscript%>
<% Response.Expires = 0 %>
<HTML>
<HEAD>
<TITLE>Dynamically Growing Form</TITLE>
</HEAD>
<BODY>
<%
If Request("Action") = "Submit the List" Then

' Show what was entered.
Response.Write "<B>Here are the Items submitted:</B><BR>"
nItems = Request.Form("Items").Count
For i = 1 To nItems
' Show submitted Items
Response.Write Request.Form("Items")(i) & "<BR>"
Next
Response.Write Request("Item") & "<BR>"

Else

' Create the form from all items. %>
<FORM Action=dynaform.asp Method=Post>
<B>Items:</B><BR>
<%
nItems = Request.Form("Items").Count
For i = 1 To nItems
' Show previously submitted Items
Response.Write "<INPUT Type=Text Name=Items Value=""" & _
Trim(Request.Form("Items")(i)) & """><BR>"
Next

If Request.Form("Item") <> "" Then
' paint a new input box, and store the old Item in Items collection
Response.Write "<INPUT Type=Text Name=Items Value=""" & _
Trim(Request.Form("Item")) & """><BR>"

Response.Write "<P>Please enter an Item,<BR>"
Response.Write "and submit them one at a time<BR>"
Response.Write "by pressing the Add Item button.<BR>"
Response.Write "<INPUT Type=Text Size=50 Name=Item Value="""""">"
Else
' No Item was submitted, don't show an error
Response.Write "<P>Please enter an Item,<BR>"
Response.Write "and submit them one at a time<BR>"
Response.Write "by pressing the Add Item button.<BR>"
Response.Write "<INPUT Type=Text Size=40 Name=Item Value="""""">
<BR>"
End If

%>

<P>
<INPUT Type="Submit" Name="Action" Value="Add Item to List">
<INPUT Type="Submit" Name="Action" Value="Submit the List">
<BR>

<% End If %>

</FORM>
</BODY>
</HTML>

問: 如何使用ASP利用ADO呼叫SQLstored procedure 答: 以下有三種方式可做,以下例子是使用command物件呼叫sample stored procedure sp_test,然後這個stored procedure 會接受一個整數值為參數並會回傳一個整數值。

<%@ LANGUAGE="VBSCRIPT" %>
<!--#include virtual="/ASPSAMP/SAMPLES/ADOVBS.INC"-->
<HTML>
<HEAD><TITLE>Place Document Title Here</TITLE></HEAD>
<BODY>
方法一是查詢data source stored procedure的參數,這是較沒效率的方式為<BR>
<%
Set cn = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
cn.Open "data source name", "userid", "password"
Set cmd.ActiveConnection = cn
cmd.CommandText = "sp_test"
cmd.CommandType = adCmdStoredProc
' Ask the server about the parameters for the stored proc
cmd.Parameters.Refresh
' Assign a value to the 2nd parameter.
' Index of 0 represents first parameter.
cmd.Parameters(1) = 11
cmd.Execute
%>
呼叫經由方法一<BR>
ReturnValue = <% Response.Write cmd.Parameters(0) %><P>

<!-- ************************************************************ -->

方法二是以宣告stored procedure, 接著直接宣告這個參數<BR>
<%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "data source name", "userid", "password"
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
cmd.CommandText = "sp_test"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _
adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _
adParamInput)
' Set value of Param1 of the default collection to 22
cmd("Param1") = 22
cmd.Execute
%>
呼叫經由方法二<BR>
ReturnValue = <% Response.Write cmd(0) %><P>

<!-- ************************************************************ -->

方法三是最常用的方式,使用標準方式 <%
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open "data source name", "userid", "password"
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
' Define the stored procedure's inputs and outputs
' Question marks act as placeholders for each parameter for the
' stored procedure
cmd.CommandText = "{?=call sp_test(?)}"
' specify parameter info 1 by 1 in the order of the question marks
' specified when we defined the stored procedure
cmd.Parameters.Append cmd.CreateParameter("RetVal", adInteger, _
adParamReturnValue)
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, _
adParamInput)
cmd.Parameters("Param1") = 33
cmd.Execute
%>
呼叫經由方法三<BR>
ReturnValue = <% Response.Write cmd("RetVal") %><P>
</BODY>
</HTML>

問: 我的程式中是否能放入Option Explicit?
Option Explicit
Response.Expires = 0
答: 不可以,Option Explicit是必須以Visual Basic呼叫。 問: 如何在ASP程式中設定session timeout的長短? 答: 舉例 Session.timeout=10 (單位為分鐘),此功能僅用在ASP 2.0以上版本。 問: 如果使用者不接受cookie會發生何種狀況? 答: 這時候,每一個 non cookie hit 都會產生一個新的session,而這個產生的session將是毫無意義的。 問: 要如何設定ASPcache 答: 1.進入IIS服務管理員 (MMC
2.展開Internet Information Server,選擇伺服器
3.按滑鼠右鍵,選property(內容)
4.
Internet Information Server tab 的主要內容選"WWW服務" 並編輯
5.進入後選擇"主目錄" tab,在應用程式設定項目中按 "設定"
6.
進入後選"處理程序選項" tab,就可以看到"指令檔快取記憶體" 下有三項可選擇
不要快取處理
ASP檔案
快取處理所有要求的
ASP檔案
要快取處理的
ASP檔案的最多數目[ ] 問: 當使用了Proxy Server的情況下Webpage回傳一個"Object Moved"的錯誤,要如何修改asp程式解決這個問題? 答: <%
response.redirect ....
%>

以下的程式碼可以解決Proxy Server發出page moved訊息
<%
response.clear
response.redirect ...
%>

問: 什麼時候增加ASP script engine cache,可以幫助運行的效率? 答: 當使用超過30個不同asp pages,就必須增加AspScriptEngineCacheMax Metabase 參數值。 問: 使用 On filesystemobject.filecopy 方法,得到以下錯誤訊息,應該如何處理?

Microsoft VBScript runtime error '800a0046'
Permission denied

答: 請確定最後的參數有包含一個反斜線(backslash) ,說明如下

"c:/temp/"
而不是 c:/temp"

問: 如何設計一個page可以對每個登入的使用者提示歡迎的祝賀語如下?

Welcome <NT Username>

答: 可利用以下的code
'Store the NT LOGON name minus the doamin name in a session variable
LN = Request.ServerVariables("REMOTE_USER")
Session("NTLogon") = UCase(Right(LN, Len(LN) - InStr(1, LN, "/")))

問: 是否有可能去讀取以及解析在其他site的檔案而無須附加其他的元件? 答: 可以的,但只有使用java applet,可以使用 java.net.URLConnection class取得URL的內容,接著再利用其他程式碼做解析的工作。 問: access自己web site 下的virtual directory ,會發生以下的錯誤訊息,該如何處理?

HTTP/1.1 500 Server Error -2146646015 (0x800cc801)

答: 這個錯誤是產生於 IIS Metabase (放置所有 config data 的地方) 這表示可能部份的data 已經找不到了,舉例而言,若是要求access某個Vdir的路徑,而實際上並不存在,這個錯誤就會發生。 問: 為何IISOnline文件的Index tab沒有包含所有的章節? 答: 由於有部份的Online文件是從其他元件取得而不屬於IIS(SMTP,NNTP),所以並不會被列在主Index 問: 為何無法在PWS 或是NT Workstation 版的IIS上做搜尋文件? 答: 由於Online文件的搜尋元件的控制是來自於Index Server,而Index Server只工作在NT Server上,因此在Windows 95/98PWS或是 NT WorkstationIISOnline文件上都不會有Index tab 問: 為何當disable 自動密碼同步後,匿名使用者無法進入web site 答: 當建立使用者帳戶沒有密碼,而這個帳戶為www以及ftp的匿名使用者帳戶,接著enable自動密碼同步,此時對NT而言,個密碼是有效的。此時我們將著個匿名使用者密碼從metabase 中清除,然後disable 自動密碼同步,IIS將不會將這個密碼再自動放回metabase中。 問: ASP 1.0有哪幾個版本? 答: ASP 1.0 是版本1.12.06.0 日期為 12/6/96
ASP 1.0a
是版本 1.13.31
ASP 1.0b
是版本 1.15.14 日期為 3/14/97
ASP 1.0b
另一個hotfix 版本的 asp.dll 1.17.07 問: 發生以下的錯誤是什麼原因?

Microsoft VBScript compilation error '800a0414'
Cannot use parens when calling a Sub
/test/test.asp, line 17
myobj.movefile(fname, sfolder, tfolder)
---------------------------------------^

答: 這行命令式包含了關鍵字Call ,如下
Call myobj.movefile(fname, sfolder, tfolder) 問: 要如何強迫 session 關閉? 答: 使用 Abandon ,如下

Session.Abandon

問: 發生以下的錯誤事什麼原因,要如何解決?

error 'ASP 0115' Unexpected error
/disney/main.asp
A trappable error occurred in an external object. The script cannot continue running.

答: IUSR權限不夠所造成的。
給予
IUSR WINNT 目錄"修改"的權限才能產生 JET ODBC 暫存檔。
給予
IUSR 對儲存MS Access 檔案目錄的"讀取"權限。
問: 為何會發生"HTTP Headers already written" 的錯誤? 答: 請在程式碼的最上頭加上
response.buffer = true
接著加上
response.clear
reponse.redirect "terima.asp"
問: 使用以Microsoft Visual C++ 寫的 server-side 元件如何除錯? 答: OutputDebugString() 列出文字訊息到除錯程式的輸出視窗。 問: 當更新了在 wwwroot 目錄下的檔案,可是一定要重新啟動web server才能看到這些檔案被更新,是否由caching 所造成的問題? 答: 可能是由長檔名所造成的,如果儲存長檔名檔案由16 bit 編輯器如 Windows 3.1 Notepad, Edit, 所以若檔名 Information.asp 將縮為 Inform~1.asp. 這就是 Active Server Pages (ASP) 無法重新載入檔案的原因。 問: Internet Information Server (IIS) 如何得知要將.asp 檔案傳遞到 Microsoft Active Server Pages (ASP)? 答: 藉由registry key 對應到正確的Active Server Pages DLL:
HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/W3SVC/Parameters/Script Map
問: 為何會發生奇怪的錯誤當使用CreateObject 存取元件? 答: 當存取server-side元件時,應該使用Server.CreateObject取代CreateObject 問: 要如何設定Microsoft Internet Information Server (IIS) 讓預設網頁為default.asp 檔案? 答: 需要給予這個目錄的執行權限,否則必須在META tag 做設定,將瀏覽器指向包含這個 default.asp檔的目錄。 問: 當將一個.asp檔案放到web server上,當由瀏覽器讀取這個.asp檔案時卻可以看到整個.asp程式碼,有什麼不對呢? 答: 以下幾個可能的因素
1. 檔案忘了給.asp延伸檔名。
2. IIS設定中,沒有給予這個放置.asp檔案的目錄執行的權限。
3. file:C:/wwwroot/myfile.asp 存取.asp檔案,請改用
     http://myserv/myfile.asp
問: 哪些作業系統支援執行ASP 答: :NT 4.0 ServerMT 4.0 workstation with Peer Web ServicesWindows 95 with Personal Web ServerNT 3.51不支援,NT 4.0 MIPS也不支援。 問: 是否能夠從一支asp程式呼叫在另一支asp程式的副程式或函數? 答: 由於每一支asp程式是個別被編譯而且只存在於當這支asp程式被要求執行,所以必須以include的方式將另一支asp程式加入,當然這時候的這支asp程式就會先將包含有要呼叫的副程式的asp程式include進來,接著編譯並且執行。 問: 是否能夠從一支asp程式存取在另一支asp程式的變數? 答: 由於每一支asp程式是個別被編譯而且只存在於當這支asp程式被要求執行,所以變數只存在於各自的asp 問: VBScript 是否在Response.Redirect執行後執行? 答: 不可以,VBScript Response.Redirect之後不執行。 問: VBScript 是否在Response.End執行後執行? 答: 不可以,VBScript Response.End之後不執行,HTML跟著Response.End並法將結果輸出到client端,Response.End只是代表敘述這是 End 問:
Response object error 'ASP 0156' Header Error
/intranet_devel/scripts/CheckLog.asp, line 14
The HTTP headers are already written to the client
browser. Any HTTP header modifications must be made before writing page content.

什麼原因會產生上述錯誤訊息?

答: 這個錯誤肇因於在更改ResponseHeader輸出 HTML 之前,因此變更Response Header必須是一致的,例如Response.Expires=0,此乃HTTP 協定的限制。 問: Session變數是否能使用在web farm? 答: 不可以,session 變數無法使用在多伺服器的web farmSession變數是以個別服器為基礎,而且若是下一個HTTP的要求是要將之傳到另一個伺服器則會被當成沒有session 變數。 問: 'ASP 0113'The max amount of time for a script to execute was
exceed, you can change this limit by specifying a
new value for the property server. Script Time out
or by changing the value for Script Time out.

什麼原因會產生上述錯誤訊息?

答: 這個錯誤可能是發生在有一個無限迴路在asp程式碼中,可能是recordset.MoveNext 或是其他的。 問:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][dbnmpntw]ConnectionOpen (CreateFile()).

什麼原因會產生上述錯誤訊息?

答: 這個錯誤可能是發生在使用NamePipe連接SQLServer,通常是IUSER_MACHINE帳號並不為遠端的SQL Server所承認。 問:
Server object error 'ASP 0177:80040112'
Server.CreateObject Failed [Filename], line [line number]
The call to Server.CreateObject failed. The requested object instance cannot be created.

什麼原因會產生上述錯誤訊息?

答: 這個錯誤可能是
1. 沒有ADODB license key 登錄在registry
2. IUSER_MACHINE
帳號沒有權限閱讀這個registry key 問:
Microsoft VBScript runtime error '800a000d'
Type mismatch

什麼原因會產生上述錯誤訊息?

答: 最有可能的的原因是VBS形態不相容,這通常發生在傳參數到物件方法。 問:
Error ASP 0115 unexpected error.
Trappable error occured in an external object, the script cannot continue running.

什麼原因會產生上述錯誤訊息?

答: 這是ASP已經抓到一個錯誤在物件中,這經常常發生,ADO經常丟出這樣的錯誤訊息是當IUSER_MACHINE無法抓到所有需要的ODBC DLL。在所有的ASP0115的錯誤訊息中,這最常發生。 問:
Server object error 'ASP 177:800401f3'Server.CreateObject Failed
/aspsamp/tutorial/lessons/Finance.asp, line 52
The call to Server.CreateObject failed. The requested object instance cannot be created.

什麼原因會產生上述錯誤訊息?

答: 這應該是PROGID 形態錯誤所造成的。 問:
Server object error 'ASP 0177:80040154 'Server.createobject failed
/advworks/equipment/equip.asp, line 2
The call to server.createobject failed The requeted object instance can not be created.

什麼原因會產生上述錯誤訊息?

答: 這應該是由於沒有這個classregistry中,但也經常發生在IUSER_MACHINE沒有適當的權限去登入伺服器。 問: 由於cookie的生命週期僅發生在目前的IE session,如果結束IE並且重新啟動IE ,這時 cookie就消逝了,應如何控制cookie的使用期限? 答: 同時設定cookie以及期限,
Response.Cookies("mycookie") = "Y"
Response.Cookies("mycookie").Expires = "December 31, 1999"
問: 如何由client端得知螢幕解析度? 答: 使用server變數,
response.write(request.servervariables("http_ua_pixels"))
這將可以得知使用者的螢幕解析度,不過這適用於使用Netscape瀏覽器。