Dim url As String
Dim queryString As String
Dim sQueryStringValues() As String
Dim sIndustrySectorId As String
Dim sSiteId As String
Dim sMode As String
'1. url is normal
'2. url is empty
'3. SiteID is missing
url = "http://localhost/Posting/templates/SiteXsl.asp?IndustryID=0&SiteID=4&Mode=4"
'url = ""
'url = "http://localhost/Posting/templates/SiteXsl.asp?IndustryID=0&Mode=4"
If InStr(1, url, "?", vbTextCompare) Then
queryString = Split(url, "?")(1)
If InStr(1, queryString, "&", vbTextCompare) Then
sQueryStringValues = Split(queryString, "&")
Dim str As Variant
For Each str In sQueryStringValues
If InStr(1, str, "SiteID=", vbTextCompare) Then
sSiteId = Replace(str, "SiteID=", "")
ElseIf InStr(1, str, "IndustryID=", vbTextCompare) Then
sIndustrySectorId = Replace(str, "IndustryID=", "")
ElseIf InStr(1, str, "Mode=", vbTextCompare) Then
sMode = Replace(str, "Mode=", "")
End If
Next
MsgBox "IndustrySectorID: " & sIndustrySectorId
MsgBox "SiteID: " & sSiteId
MsgBox "Mode: " & sMode
End If
End If
Comments