บางครั้งคุณต้องได้รับ URL, พอร์ต, ชื่อไฟล์พา ธ , พารามิเตอร์ ฯลฯ ที่นี่ฉันจะแชร์รหัสฟังก์ชันนี้กับคุณ เพื่อนที่ต้องการมันสามารถอ้างถึงมันได้
ฟังก์ชั่น 1
<%ฟังก์ชั่น getUrl () ในข้อผิดพลาดกลับมาทำงานต่อไป dim strtempif lcase (request.serverVariables ("https")) = "ปิด" thenstrtemp = "http: //" elsestrtemp = "https: // request.serverVariables ("server_port") <> 80 จากนั้น strtemp = strtemp & ":" & request.serverVariables ("server_port") strtemp = strtemp & request.servervariables ("url") ถ้าตัด & trim (request.querystring) getUrl = strTempend functionResponse.write getUrl ()%>ฟังก์ชั่น 2
<!-รับพา ธ หน้าปัจจุบัน-> <%dim str, โฮสต์, url, คำหลัก, fullstr = "http: //"; host = request.serverVariables ("http_host") url = request.serverVariables ("path_info") str & host & url & "?" & keyworddelsefull = str & host & urlend ifsession ("url") = full%>หากคุณใช้มันคุณต้องเลือกอันแรกซึ่งรองรับการตัดสิน HTTPS
หากผ่านหน้า 404 สิ่งนี้จะไม่สามารถรับได้และจำเป็นต้องนำไปใช้ร่วมกับ JS
ตัวอย่างเช่น:
หน้า JS
<script> var pathName = window.location.pathName; location.replace ("/do.asp? p ="+ชื่อพา ธ ); </script>ผ่านพารามิเตอร์เส้นทางที่จะทำ. asp สำหรับการประมวลผล
strpath = คำขอ ("p")
คุณสามารถรับหน้าก่อน 404 จากนั้นทำการดำเนินการให้ความสนใจกับการอนุญาตไดเรกทอรี นอกจากนี้คุณยังสามารถวางไว้ใน 404 และลงโทษ iframe สำหรับการดำเนินการ