accessing Request.Browser throws an exception

  • Thread starter Thread starter germ
  • Start date Start date
G

germ

we are running into a situation where accessing Request.Browser.MajorVersion
causes a System.ArgumentNullException.

when this happens the HTTP_USER_AGENT value is "Mozilla/4.x (Win95)"

I am assuming that this problem is that this agent string is not being
recognized.
I would have thought that this would result in some type of unknown browser
browser object being created rather that had some type of value for all
properties but surely nothing null.

Is there a fix for this or do we have to wrap all references to
Request.Browser in a try/catch ?

Gerry
 
germ said:
we are running into a situation where accessing Request.Browser.MajorVersion
causes a System.ArgumentNullException.

when this happens the HTTP_USER_AGENT value is "Mozilla/4.x (Win95)"

I am assuming that this problem is that this agent string is not being
recognized.
I would have thought that this would result in some type of unknown browser
browser object being created rather that had some type of value for all
properties but surely nothing null.

There is nothing in the documentation about the Browser property that it
may be null, but obviously it can.
Is there a fix for this or do we have to wrap all references to
Request.Browser in a try/catch ?

Just check if the Browser property is null before using it.
 
Back
Top