l Request Server Variables REMOTEADDR Client IP l


讀取環境變數 l 語法 • Request. Server. Variables(“參數”) REMOTE_ADDR – Client IP l LOCAL_ADDR – Server IP l APPL_PHYSICAL_PATH – 根目錄的實際路徑 l PATH_INFO – 目前ASP網頁的虛擬路徑 l PATH_TRANSLATED – 目前ASP網頁的實際路 徑 l QUERY_STRING – 檔案所傳入的參數字串 l


寫入/讀取 Cookies l 寫入:Response. Cookies(“名稱”)=值 • Ex. Response. Cookies(“Name”)=“Carrot” l 讀取:Request. Cookies(“名稱”) • Ex. <%=Request. Cookies(“Name”)%> l 設定過期日期 • Response. Cookies(“名稱”). Expires = “yyyy/mm/dd” • Ex. Expire. Date = Date. Add(“d”, 30, Date) Response. Cookies(“Name”). Expires = Expire. Date l 注意!寫入Cookies一定要在輸出資料前

Server 物件 l Server. Mappath – 網址路徑與實際路徑之 轉換 • Ex. Server. Mappath(“/”) – C: Inetpubwwwroot l Server. HTMLEncode – HTML 編碼 • Ex. Server. HTMLEncode(“換行 ”) 畫面輸出:換行< br> l Server. Create. Object – 建立Active. X物件, 常應用在與資料庫連結時









- Slides: 14