/ Published in: VB.NET
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
Public Function AddQuerystringVar(ByVal strURL As String, ByVal QuerystringKey As String, ByVal QuerystringValue As String) As String strURL = RemoveQuerystringVar(strURL, QuerystringKey) ' Remove value if already in URL Return strURL + "?" + QuerystringKey + "=" + QuerystringValue Else Return strURL + "&" + QuerystringKey + "=" + QuerystringValue End If End Function Public Function RemoveQuerystringVar(ByVal strURL As String, ByVal QuerystringKey As String) As String Dim re As New Regex("(.*)(\?|&)" + QuerystringKey + "=[^&]+?(&)(.*)", RegexOptions.IgnoreCase) strURL = Mid(strURL, 1, (strURL.Length - 1)) Return strURL End Function