Bug in ASP.NET (Request.Browser)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am a .NET Professional and working in web development.
I found a bug (i think so) while using Request.Browser object to identify the browser name and version.
It shows me the correct browser name and version when i request the page from Internet Explorer 6.0. But
when i request the page from Netscape 7.1 it shows me the version as 5.0 and major version as 5 and minor version as 0.

Is it a bug? Please clarify.
 
Hi Ganesh,

You could try and view the HttpHeader "User-Agent" instead to see what the
browser is actually sending to the web server. The easiest way to view this
is to enable page tracing on a .aspx in your application.

Hope this helps,
Michael
 
Sounds like your machine.config could be missing Netscape 7, I've just look
at mine and netscape 7 is not in.

search for "(Gecko/[-\d]+ )?Netscape6/(?'versio"

changing 6 to [6/7] may fixit, this is just a guess, i dont use netscape 7
so i cannot test it.

try a google on netscape 7 machine.config

you will also find that if you output.renderbegintab("DIV") it will render a
TABLE with 0 borders, this is due to the TAGWRITER and can be fixed by
adding tagwriter=System.Web.UI.HtmlTextWriter to the correct section.

Cheers

Steve


Ganesh said:
I am a .NET Professional and working in web development.
I found a bug (i think so) while using Request.Browser object to identify the browser name and version.
It shows me the correct browser name and version when i request the page
from Internet Explorer 6.0. But
when i request the page from Netscape 7.1 it shows me the version as 5.0
and major version as 5 and minor version as 0.
 
Hi Steve Drake,

Many Thanks for your reply. I went through machine.config file in mymachine.
I found a silly mistake done in evaluating the user agent through regular
expression.

<case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+
)?Netscape6/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">

To find the version they mentioned the pattern as "?Netscape6". but the
user agent returns the string which contains the version information as
Netscape/7.1 (ax). So it should have been mentioned as Netscape/ instead of
Netscape6/.

I have changed it and tested and it seems working fine.

Hope microsoft would rectify this in next version.

Regards
T.Ganesh

Steve Drake said:
Sounds like your machine.config could be missing Netscape 7, I've just look
at mine and netscape 7 is not in.

search for "(Gecko/[-\d]+ )?Netscape6/(?'versio"

changing 6 to [6/7] may fixit, this is just a guess, i dont use netscape 7
so i cannot test it.

try a google on netscape 7 machine.config

you will also find that if you output.renderbegintab("DIV") it will render a
TABLE with 0 borders, this is due to the TAGWRITER and can be fixed by
adding tagwriter=System.Web.UI.HtmlTextWriter to the correct section.

Cheers

Steve


Ganesh said:
I am a .NET Professional and working in web development.
I found a bug (i think so) while using Request.Browser object to identify the browser name and version.
It shows me the correct browser name and version when i request the page
from Internet Explorer 6.0. But
when i request the page from Netscape 7.1 it shows me the version as 5.0
and major version as 5 and minor version as 0.
Is it a bug? Please clarify.
 
Back
Top