473,408 Members | 1,960 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

HttpBrowserCapabilities not returning correct netscape version

When I try to get the netscape version for version 7, I get the
HttpBrowserCapabilities class returning the version as 5 and not 7.
(see code and output below)
CODE
HttpBrowserCapabilities bc;
string s;
bc = Request.Browser;
....
s += "Type = " + bc.Type + "<br>" + "\n";
s += "Name = " + bc.Browser + "<br>" + "\n";
s += "Version = " + bc.Version + "<br>" + "\n";
s += "Major Version = " + bc.MajorVersion + "<br>" + "\n";
s += "Minor Version = " + bc.MinorVersion + "<br>" + "\n";
OUTPUT

Type = Netscape5
Name = Netscape
Version = 5.0
Major Version = 5
Minor Version = 0

When I use

s += Request.ServerVariables["http_user_agent"];

I get the output

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
Gecko/20030208 Netscape/7.02

which does contain the version 7.02 in the string.

Do I need to use the ServerVariables string to get the correct version
number or is there a better way???

Earl
Nov 17 '05 #1
4 2793
Earl,

Let me look into this. At first glance, I'd say that the Regular
Expressions in the browserCaps element in the machine.config file need to
be updated to recognize Netscape 7.

I'll update you as soon as I can.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: ea******@hotmail.com (Earl T)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: HttpBrowserCapabilities not returning correct netscape version
Date: 14 Oct 2003 14:11:19 -0700
Organization: http://groups.google.com
Lines: 40
Message-ID: <ad**************************@posting.google.com >
NNTP-Posting-Host: 12.45.135.78
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1066165879 29724 127.0.0.1 (14 Oct 2003 21:11:19 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Tue, 14 Oct 2003 21:11:19 +0000 (UTC)
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!news.maxwell.syr.edu!postnews1.google.com!not-for-mailXref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:184139
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

When I try to get the netscape version for version 7, I get the
HttpBrowserCapabilities class returning the version as 5 and not 7.
(see code and output below)
CODE
HttpBrowserCapabilities bc;
string s;
bc = Request.Browser;
...
s += "Type = " + bc.Type + "<br>" + "\n";
s += "Name = " + bc.Browser + "<br>" + "\n";
s += "Version = " + bc.Version + "<br>" + "\n";
s += "Major Version = " + bc.MajorVersion + "<br>" + "\n";
s += "Minor Version = " + bc.MinorVersion + "<br>" + "\n";
OUTPUT

Type = Netscape5
Name = Netscape
Version = 5.0
Major Version = 5
Minor Version = 0

When I use

s += Request.ServerVariables["http_user_agent"];

I get the output

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
Gecko/20030208 Netscape/7.02

which does contain the version 7.02 in the string.

Do I need to use the ServerVariables string to get the correct version
number or is there a better way???

Earl


Nov 17 '05 #2
Jim,

After looking in the BrowserCaps section, I would say you are probably
correct. There is a regular expression to find netscape v6 but not v7. I
tried to add a case statement for v7 but it did not work (maybe because I no
nothing of how this really works)

I am sure that others must have run up against this and found a
solution???(like an updated browsercaps section)

Earl
"Jim Cheshire [MSFT]" <ja******@online.microsoft.com> wrote in message
news:Rp**************@cpmsftngxa06.phx.gbl...
Earl,

Let me look into this. At first glance, I'd say that the Regular
Expressions in the browserCaps element in the machine.config file need to
be updated to recognize Netscape 7.

I'll update you as soon as I can.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: ea******@hotmail.com (Earl T)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: HttpBrowserCapabilities not returning correct netscape version
Date: 14 Oct 2003 14:11:19 -0700
Organization: http://groups.google.com
Lines: 40
Message-ID: <ad**************************@posting.google.com >
NNTP-Posting-Host: 12.45.135.78
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1066165879 29724 127.0.0.1 (14 Oct 2003 21:11:19 GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Tue, 14 Oct 2003 21:11:19 +0000 (UTC)
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:184139X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

When I try to get the netscape version for version 7, I get the
HttpBrowserCapabilities class returning the version as 5 and not 7.
(see code and output below)
CODE
HttpBrowserCapabilities bc;
string s;
bc = Request.Browser;
...
s += "Type = " + bc.Type + "<br>" + "\n";
s += "Name = " + bc.Browser + "<br>" + "\n";
s += "Version = " + bc.Version + "<br>" + "\n";
s += "Major Version = " + bc.MajorVersion + "<br>" + "\n";
s += "Minor Version = " + bc.MinorVersion + "<br>" + "\n";
OUTPUT

Type = Netscape5
Name = Netscape
Version = 5.0
Major Version = 5
Minor Version = 0

When I use

s += Request.ServerVariables["http_user_agent"];

I get the output

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
Gecko/20030208 Netscape/7.02

which does contain the version 7.02 in the string.

Do I need to use the ServerVariables string to get the correct version
number or is there a better way???

Earl

Nov 17 '05 #3
Jim,

I found this code in another artical on this newsgroup and it now reports
the correct netscape (major) version, which is all I care about. I added it
to my web.config file but suppose I can add it to the machine.config
instead?

Earl
Try this code in your web.config file (place between the <system.web> tags)

<browserCaps>

<case match="Gecko/[-\d]+">

browser=Netscape

frames=true

tables=true

cookies=true

javascript=true

javaapplets=true

ecmascriptversion=1.5

w3cdomversion=1.0

css1=true

css2=true

xml=true

tagwriter=System.Web.UI.HtmlTextWriter

<case match="rv:1.0[^\.](?'letters'\w*)">

version=6.0

majorversion=6

minorversion=0

<case match="^b" with="${letters}">

beta=true

</case>

</case>

<case match="rv:1(\.\d+)(\.\d)?(?'letters'\w*)">

version=7.0

majorversion=7

minorversion=0

<case match="^b" with="${letters}">

beta=true

</case>

</case>

</case>

</browserCaps>
"Jim Cheshire [MSFT]" <ja******@online.microsoft.com> wrote in message
news:Rp**************@cpmsftngxa06.phx.gbl...
Earl,

Let me look into this. At first glance, I'd say that the Regular
Expressions in the browserCaps element in the machine.config file need to
be updated to recognize Netscape 7.

I'll update you as soon as I can.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: ea******@hotmail.com (Earl T)
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: HttpBrowserCapabilities not returning correct netscape version
Date: 14 Oct 2003 14:11:19 -0700
Organization: http://groups.google.com
Lines: 40
Message-ID: <ad**************************@posting.google.com >
NNTP-Posting-Host: 12.45.135.78
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1066165879 29724 127.0.0.1 (14 Oct 2003 21:11:19 GMT)
X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Tue, 14 Oct 2003 21:11:19 +0000 (UTC)
Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:184139X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

When I try to get the netscape version for version 7, I get the
HttpBrowserCapabilities class returning the version as 5 and not 7.
(see code and output below)
CODE
HttpBrowserCapabilities bc;
string s;
bc = Request.Browser;
...
s += "Type = " + bc.Type + "<br>" + "\n";
s += "Name = " + bc.Browser + "<br>" + "\n";
s += "Version = " + bc.Version + "<br>" + "\n";
s += "Major Version = " + bc.MajorVersion + "<br>" + "\n";
s += "Minor Version = " + bc.MinorVersion + "<br>" + "\n";
OUTPUT

Type = Netscape5
Name = Netscape
Version = 5.0
Major Version = 5
Minor Version = 0

When I use

s += Request.ServerVariables["http_user_agent"];

I get the output

Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
Gecko/20030208 Netscape/7.02

which does contain the version 7.02 in the string.

Do I need to use the ServerVariables string to get the correct version
number or is there a better way???

Earl

Nov 17 '05 #4
Hi Earl,

You can add it to either. However, if you want it available to any Web
application, the machine.config is probably the way to go.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
From: "Earl Teigrob" <ea******@hotmail.com>
References: <ad**************************@posting.google.com > <Rp**************@cpmsftngxa06.phx.gbl>Subject: Re: HttpBrowserCapabilities not returning correct netscape version
Date: Wed, 15 Oct 2003 09:00:26 -0500
Lines: 159
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Or*************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.framework.aspnet
NNTP-Posting-Host: 12.45.135.72
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:184309
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

Jim,

I found this code in another artical on this newsgroup and it now reports
the correct netscape (major) version, which is all I care about. I added it
to my web.config file but suppose I can add it to the machine.config
instead?

Earl
Try this code in your web.config file (place between the <system.web> tags)

<browserCaps>

<case match="Gecko/[-\d]+">

browser=Netscape

frames=true

tables=true

cookies=true

javascript=true

javaapplets=true

ecmascriptversion=1.5

w3cdomversion=1.0

css1=true

css2=true

xml=true

tagwriter=System.Web.UI.HtmlTextWriter

<case match="rv:1.0[^\.](?'letters'\w*)">

version=6.0

majorversion=6

minorversion=0

<case match="^b" with="${letters}">

beta=true

</case>

</case>

<case match="rv:1(\.\d+)(\.\d)?(?'letters'\w*)">

version=7.0

majorversion=7

minorversion=0

<case match="^b" with="${letters}">

beta=true

</case>

</case>

</case>

</browserCaps>
"Jim Cheshire [MSFT]" <ja******@online.microsoft.com> wrote in message
news:Rp**************@cpmsftngxa06.phx.gbl...
Earl,

Let me look into this. At first glance, I'd say that the Regular
Expressions in the browserCaps element in the machine.config file need to
be updated to recognize Netscape 7.

I'll update you as soon as I can.

Jim Cheshire [MSFT]
Developer Support
ASP.NET
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.

--------------------
>From: ea******@hotmail.com (Earl T)
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Subject: HttpBrowserCapabilities not returning correct netscape version
>Date: 14 Oct 2003 14:11:19 -0700
>Organization: http://groups.google.com
>Lines: 40
>Message-ID: <ad**************************@posting.google.com >
>NNTP-Posting-Host: 12.45.135.78
>Content-Type: text/plain; charset=ISO-8859-1
>Content-Transfer-Encoding: 8bit
>X-Trace: posting.google.com 1066165879 29724 127.0.0.1 (14 Oct 2003

21:11:19 GMT)
>X-Complaints-To: gr**********@google.com
>NNTP-Posting-Date: Tue, 14 Oct 2003 21:11:19 +0000 (UTC)
>Path:

cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.c

o
m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
>Xref: cpmsftngxa06.phx.gblmicrosoft.public.dotnet.framework.aspnet:184139 >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>When I try to get the netscape version for version 7, I get the
>HttpBrowserCapabilities class returning the version as 5 and not 7.
>(see code and output below)
>
>
>CODE
>HttpBrowserCapabilities bc;
>string s;
>bc = Request.Browser;
>...
>s += "Type = " + bc.Type + "<br>" + "\n";
>s += "Name = " + bc.Browser + "<br>" + "\n";
>s += "Version = " + bc.Version + "<br>" + "\n";
>s += "Major Version = " + bc.MajorVersion + "<br>" + "\n";
>s += "Minor Version = " + bc.MinorVersion + "<br>" + "\n";
>
>
>OUTPUT
>
>Type = Netscape5
>Name = Netscape
>Version = 5.0
>Major Version = 5
>Minor Version = 0
>
>When I use
>
>s += Request.ServerVariables["http_user_agent"];
>
>I get the output
>
>Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2)
>Gecko/20030208 Netscape/7.02
>
>which does contain the version 7.02 in the string.
>
>Do I need to use the ServerVariables string to get the correct version
>number or is there a better way???
>
>Earl
>



Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: j erickson | last post by:
with the following xsl and xml file, the display of the gif file with the <image/url> tag works. However, the gif file in the <description> tag using the name attribute "src" won't make the correct...
4
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript...
6
by: Derrick | last post by:
Hello all; Since I do have working code, this is more for my curiosity only. I'm creating a "Plugin" architecture, following some of the many examples on the 'net. Basically what I have is...
1
by: Earl T | last post by:
When I try to get the netscape version for version 7, I get the HttpBrowserCapabilities class returning the version as 5 and not 7. (see code and output below) CODE HttpBrowserCapabilities...
2
by: kevinwjames | last post by:
I'm writing a C# app which analyzes and reports on IIS web logs. I've got it producing numbers for hits, visits, ips, etc. but I'm having trouble parsing the UserAgent string so I can get Browser,...
4
by: Nathan Sokalski | last post by:
I was testing out a page of mine that displays the information from Page.Request.Browser. It works exactly as I expected in Internet Explorer and Netscape 4.75 (I didn't expect much in Netscape...
5
by: Robert W. | last post by:
I just added this line of code to a simple aspx page: HttpBrowserCapabilities browserCap = new HttpBrowserCapabilities(); Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
4
by: =?Utf-8?B?Wm9sdA==?= | last post by:
Hi, Would someone know where I could get a list of the supported crawlers for the HttpBrowserCapabilities? Is there a way to add new ones/modify the list? I have a web site for which I want to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.