|
本文主讲在vb.net中快速获取当前url的方法,不多说,先看代码!
Protected Function GetUrl() As String Dim strTemp As String = "" If (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")) If (Request.QueryString.ToString.Trim.Length <> 0) Then strTemp = (strTemp + ("?" + Request.QueryString)) End If Return strTem
End Function
试了没有啊,有效果吗?
|