Discuz教程网

asp中获取当前页面的地址与参数的函数代码

[复制链接]
authicon dly 发表于 2011-9-10 21:51:50 | 显示全部楼层 |阅读模式
  1. Function getCurrentUrl()
  2. On Error Resume Next
  3. Dim strTemp
  4. If LCase(Request.ServerVariables("HTTPS")) = "off" Then
  5. strTemp = "http://"
  6. Else
  7. strTemp = "https://"
  8. End If
  9. strTemp = strTemp & Request.ServerVariables("SERVER_NAME")
  10. If Request.ServerVariables("SERVER_PORT") <> 80 Then
  11. strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")
  12. end if
  13. strTemp = strTemp & Request.ServerVariables("URL")
  14. getCurrentUrl = strTemp
  15. End Function

  16. Function getUrlWithParams()
  17. Dim ScriptAddress,Servername,qs
  18. ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))
  19. Servername = CStr(Request.ServerVariables("Server_Name"))
  20. qs=Request.QueryString
  21. If Request.ServerVariables("SERVER_PORT") <> 80 Then
  22. Servername = Servername & ":" & Request.ServerVariables("SERVER_PORT")
  23. end if
  24. if qs<>"" then
  25. getUrlWithParams ="http://"& Servername & ScriptAddress &"?"&qs
  26. else
  27. getUrlWithParams ="http://"& Servername & ScriptAddress
  28. end if
  29. End Function
复制代码




上一篇:ASP读取日期单日期自动补零函数代码
下一篇:asp中文件与文件夹常用处理函数(文件后缀、创建文件等)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

1314学习网 ( 浙ICP备10214163号 )

GMT+8, 2025-5-2 20:13

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表