Private Sub sport()
Dim currurl As String = HttpContext.Current.Request.RawUrl
Dim querystring As String = Nothing
' Check to make sure some query string variables
' exist and if not add some and redirect.
Dim iqs As Int32 = currurl.IndexOf("?".ToCharArray())
If (iqs = -1) Then
Dim redirecturl As String = currurl
Response.Redirect(redirecturl, True)
' If query string variables exist, put them in
' a string.
ElseIf (iqs >= 0) Then
If (iqs < currurl.Length - 1) Then
querystring = currurl.Substring(iqs + 1)
End If
End If
' Parse the query string variables into a NameValueCollection.
Dim qscoll As NameValueCollection = HttpUtility.ParseQueryString(querystring)
' Iterate through the collection.
Dim sb As New StringBuilder("?")
Dim newQuery As String = "?"
For Each s As String In qscoll.AllKeys
sb.Append(s & "=" & qscoll(s))
If s = "sport" Then
newQuery = newQuery
End If
If s = "brand" Then
newQuery = newQuery & s & "=" & qscoll(s)
End If
If s = "product" Then
newQuery = newQuery & s & "=" & qscoll(s)
End If
If s = "season" Then
newQuery = newQuery & s & "=" & qscoll(s)
End If
If s = "gender" Then
newQuery = newQuery & s & "=" & qscoll(s)
End If
If s = "age" Then
newQuery = newQuery & s & "=" & qscoll(s)
End If
Next s
'Response.Write(newQuery.ToString)
Dim newURL As String
newURL = Request.Url.LocalPath
newURL = newURL & newQuery
'Response.Write(newURL)
' Write the result to a label
'ParseOutput.Text = sb.ToString()
Response.Redirect(newURL)
End Sub
Protected Sub ImageButtonSport_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles X.Click
sport()
End Sub
|