大家可能還記得我們51CTO網(wǎng)站的關(guān)于VB.NET專題中的一些介紹,這門語言能給我們帶來非常多的好處。比如今天為大家介紹的VB.NET獲取當前URL的相關(guān)操作方法,就可以從中看出VB.NET的功能特點。
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
VB.NET獲取當前URL的具體操作方法就為大家介紹到這里。