I'm a bit stuck on how to solve this.
The edge case I'm testing for is if someone goes to the URL but removes the query params.
EXAMPLE
www.example.com
I want to be able to check if there are no URL params given then set it to a default and redirect with the default URL params.
EXPECTED RESULT
www.example.com?year=2016
This is my code I'm using or misusing. Some help would be very much appreciated.
Dim noURLParam As String = ""
If Not(Request.QueryString("Year") Is Nothing) Then
If Request.QueryString("Year").ToString() <> "" Then
noURLParam = Request.QueryString("Year").ToString()
End If
End If
The way your code is currently structured you can simply do this
And
2017will be the default if no value is provided foryearin the querystring.