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

复制代码 代码如下:

Function getCurrentUrl()

On Error Resume Next

Dim strTemp

If LCase(Request.ServerVariables("HTTPS")) = "off" Then

strTemp = "http://"

Else

strTemp = "https://"

End If

strTemp = strTemp & Request.ServerVariables("SERVER_NAME")

If Request.ServerVariables("SERVER_PORT") <> 80 Then

strTemp = strTemp & ":" & Request.ServerVariables("SERVER_PORT")

end if

strTemp = strTemp & Request.ServerVariables("URL")

getCurrentUrl = strTemp

End Function

Function getUrlWithParams()

Dim ScriptAddress,Servername,qs

ScriptAddress = CStr(Request.ServerVariables("SCRIPT_NAME"))

Servername = CStr(Request.ServerVariables("Server_Name"))

qs=Request.QueryString

If Request.ServerVariables("SERVER_PORT") <> 80 Then

Servername = Servername & ":" & Request.ServerVariables("SERVER_PORT")

end if

if qs<>"" then

getUrlWithParams ="http://"& Servername & ScriptAddress &"?"&qs

else

getUrlWithParams ="http://"& Servername & ScriptAddress

end if

End Function

时间: 2024-08-01 18:28:59

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

asp中获取当前页面的地址与参数的函数代码_应用技巧

复制代码 代码如下: Function getCurrentUrl() On Error Resume Next Dim strTemp If LCase(Request.ServerVariables("HTTPS")) = "off" Then strTemp = "http://" Else strTemp = "https://" End If strTemp = strTemp & Request.Serve

在asp.net中获取当前页面的URL的方法(推荐)_实用技巧

获取Url的方法有两种,通过后台获得或通过前面js获得,如下: 1.通过C#获取当前页面的URL string url = Request.Url.AbsoluteUri; //结果: http://www.jb51.net/web/index.aspx string host = Request.Url.Host; //结果:www.jb51.net string rawUrl = Request.RawUrl; //结果:/web/index.aspx string localPath =

在ASP中获取客户端MAC地址的方法

客户端 本程序属于一种特别的方法.使用范围比较有限,而且有一定的危险性.借鉴了asp后门里的一些方法.下面是程序代码. <%dim remoteaddrif Request.ServerVariables("HTTP_X_FORWARDED_FOR")=empty thenremoteaddr=Request.ServerVariables("REMOTE_ADDR")elseremoteaddr=Request.ServerVariables("H

小技巧:在Asp中获取客户端MAC地址的方法

技巧|客户端 本程序属于一种特别的方法.使用范围比较有限,而且有一定的危险性.借鉴了asp后门里的一些方法.下面是程序代码. <%     dim remoteaddr if Request.ServerVariables("HTTP_X_FORWARDED_FOR")=empty then remoteaddr=Request.ServerVariables("REMOTE_ADDR") else remoteaddr=Request.ServerVaria

asp 如何获取当前页面的网址

有时,您可能希望获得当前页面的网址是在浏览器窗口中显示网址.例如,如果您想让您的访客提交博客张贴到Digg您需要得到同样的确切网址.有很多其他原因也很多.这里就是你如何能够做到这一点. 下面的代码添加到页面: <% function curPageURL()  dim s, protocol, port  if Request.ServerVariables("HTTPS") = "on" then    s = "s"  else   

PHP为表单获取的URL 地址预设 http 字符串函数代码_php技巧

复制代码 代码如下: if (!preg_match("/^(http|ftp):/", $_POST['url'])) { $_POST['url'] = 'http://'.$_POST['url']; } 该代码先用正则表达式检查字符串中是否有"http"或"ftp"和冒号":",如果没有,在字符串前添加"http://"

PHP 技巧:如何获取当前页面的链接地址

其实不用找 WordPress 函数,PHP 本身就提供了一些系统变量,通过整合下就能获取当前页面的 URL. function wpjam_get_current_page_url(){     $ssl        = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? true:false;     $sp         = strtolower($_SERVER['SERVER_PROTOCOL']);     

多种语言下获取当前页完整URL及其参数_其它综合

PHP如何获取当前页完整URL及其参数  <? echo 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]."<br>"; echo $_SERVER['SERVER_NAME']."<br>";//  cike.org echo $_SERVER["SERVER_P

C#获取当前页面的URL示例代码_实用技巧

本实例的测试URL:http://www.mystudy.cn/web/index.aspx 1.通过C#获取当前页面的URL 复制代码 代码如下: string url = Request.Url.AbsoluteUri; //结果: http://www.mystudy.cn/web/index.aspx string host = Request.Url.Host; //结果:www.mystudy.cn string rawUrl = Request.RawUrl; //结果:/web/