HttpBrowserCapabilities not returning correct netscape version

Discussion in 'ASP .Net' started by Earl T, Oct 14, 2003.

  1. Earl T

    Earl T Guest

    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
    Earl T, Oct 14, 2003
    #1
    1. Advertising

  2. 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


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

    --------------------
    >From: (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: <>
    >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:
    >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: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
    >
    Jim Cheshire [MSFT], Oct 14, 2003
    #2
    1. Advertising

  3. Earl T

    Earl Teigrob Guest

    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]" <> wrote in message
    news:Rp$...
    > 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
    >
    >
    > This post is provided as-is with no warranties and confers no rights.
    >
    > --------------------
    > >From: (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: <>
    > >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:
    > >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: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
    > >

    >
    Earl Teigrob, Oct 15, 2003
    #3
  4. Earl T

    Earl Teigrob Guest

    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]" <> wrote in message
    news:Rp$...
    > 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
    >
    >
    > This post is provided as-is with no warranties and confers no rights.
    >
    > --------------------
    > >From: (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: <>
    > >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:
    > >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: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
    > >

    >
    Earl Teigrob, Oct 15, 2003
    #4
  5. 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


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

    --------------------
    >From: "Earl Teigrob" <>
    >References: <>

    <Rp$>
    >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: <>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >NNTP-Posting-Host: 12.45.135.72
    >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.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]" <> wrote in message
    >news:Rp$...
    >> 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
    >>
    >>
    >> This post is provided as-is with no warranties and confers no rights.
    >>
    >> --------------------
    >> >From: (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: <>
    >> >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:
    >> >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.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
    >> >

    >>

    >
    >
    >
    Jim Cheshire [MSFT], Oct 15, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    722
  2. =?Utf-8?B?Um9iZXJ0IFcu?=

    Does HttpBrowserCapabilities work?

    =?Utf-8?B?Um9iZXJ0IFcu?=, Apr 28, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    2,866
    Juan T. Llibre
    Apr 28, 2006
  3. Replies:
    3
    Views:
    2,808
  4. V Green
    Replies:
    0
    Views:
    845
    V Green
    Feb 5, 2008
  5. PA Bear [MS MVP]
    Replies:
    0
    Views:
    957
    PA Bear [MS MVP]
    Feb 5, 2008
Loading...

Share This Page