国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

asp獲取當(dāng)前完整路徑(url)的函數(shù)代碼

2020-07-26 23:04:41
字體:
供稿:網(wǎng)友

有時候我么您需要獲取網(wǎng)址,端口、路徑文件名、參數(shù)等,這里就為大家分享一下這個函數(shù)代碼,需要的朋友可以參考下

函數(shù)1

<%function GetUrl() on Error Resume Next Dim strTempif LCase(request.ServerVariables("HTTPS")) = "off" ThenstrTemp = "http://"ElsestrTemp = "https://" end if strTemp = strTemp & Request.ServerVariables("SERVER_NAME") if Request.ServerVariables("SERVER_PORT") <> 80 Then strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT") strTemp = strTemp & Request.ServerVariables("URL") if trim(request.QueryString) <> "" Then strTemp = strTemp & "?" & Trim(Request.QueryString) GetUrl = strTempEnd Functionresponse.write GetUrl()%>

函數(shù)2

<!--獲取當(dāng)前頁面路徑--> <% dim str,host,url,keyword,full str="http://"; host = Request.ServerVariables("HTTP_HOST") url = Request.ServerVariables("PATH_INFO") '或url keyword = Request.ServerVariables("QUERY_STRING") if keyword <> "" then full = str&host&url&"?"&keyword else full = str&host&url end if session("url")=full %>

使用的話肯定選擇第一個,支持https的判斷。

如果是通過404頁面除非,這個是獲取不到的,需要結(jié)合js來實現(xiàn)

例如:

js頁面

<script>var pathname = window.location.pathname;location.replace("/do.asp?p="+pathname);</script>

將路徑傳參給do.asp進(jìn)行處理

strpath=Request("p")

即可獲取404之前的頁面,然后進(jìn)行執(zhí)行操作即可,注意目錄權(quán)限。也可以放到404中處罰iframe進(jìn)行操作。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 武平县| 喜德县| 贵港市| 周口市| 离岛区| 万州区| 凤城市| 永吉县| 五指山市| 鹤峰县| 长寿区| 丰城市| 顺昌县| 玛曲县| 三台县| 大足县| 稷山县| 贵州省| 天气| 耒阳市| 太仆寺旗| 乐山市| 湛江市| 天等县| 泾源县| 苗栗县| 台南县| 澄城县| 日土县| 易门县| 渭南市| 新郑市| 三明市| 鹿泉市| 聂荣县| 连山| 武清区| 保定市| 山阳县| 正安县| 微山县|