I'm working on a vb.net MVC system and need to detect the browser and version.
I'll only use Chrome, and IE9 +. I would like to know if I can simplify the verification structure using Regex.
Below is the excerpt that I use to do the verification.
If (Not Request.Browser.ToString().ToLower().Contains("ie") And
Not Request.Browser.ToString().ToLower().Contains("internet explorer") And
Not Request.Browser.ToString().ToLower().Contains("chrome")) Then
Return View("IncompativelAgent")
Else
If Not Request.Browser.ToString().ToLower().Contains("chrome") And Request.Browser.MajorVersion < 9 Then
Return View("IncompativelAgent")
End If
End If
I find it very inelegant in the way it is.