nothing is wrong with the code. You compare the HTTP_ACCEPT with the string
Originally Posted by Sman5109
. The HTTP_ACCEPT you are getting is:
So there is no exact match here. The same goes for the HTTP_USER_AGENT. You compare with: , but you are getting:
So, there is no exact match either. The code is doing what it is supposed to do and goes inte the Else branch of your If statement.
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:220.127.116.11) Gecko/20070914 Firefox/18.104.22.168"
You probably want to check if the string "application/xhtml+xml" appears somewhere within the HTTP_ACCEPT variable. Then you should use the InStr() function. This function checks to see if the second provided string appears somewhere in the first provided string and returns the position where it starts. So if it returns a number larger than 0 the second string appears in the first.
If InStr(Request.ServerVariables("HTTP_ACCEPT"), "application/xhtml+xml") > 0 OR InStr(Request.ServerVariables("HTTP_USER_AGENT"), "W3C_Validator") > 0 Then