473,659 Members | 3,631 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Does HttpBrowserCapa bilities work?

I just added this line of code to a simple aspx page:

HttpBrowserCapa bilities browserCap = new HttpBrowserCapa bilities();

Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all the
properties were null. How come?

--
Robert W.
Vancouver, BC
www.mwtech.com

Apr 28 '06 #1
5 2876
Try this :

HttpBrowserCapa bilities bc = Request.Browser ;
Response.Write( "<p>Browser Capabilities:</p>");
Response.Write( "Type = " + bc.Type + "<br>");
Response.Write( "Name = " + bc.Browser + "<br>");
Response.Write( "Version = " + bc.Version + "<br>");
Response.Write( "Major Version = " + bc.MajorVersion + "<br>");
Response.Write( "Minor Version = " + bc.MinorVersion + "<br>");
Response.Write( "Platform = " + bc.Platform + "<br>");
Response.Write( "Is Beta = " + bc.Beta + "<br>");
Response.Write( "Is Crawler = " + bc.Crawler + "<br>");
Response.Write( "Is AOL = " + bc.AOL + "<br>");
Response.Write( "Is Win16 = " + bc.Win16 + "<br>");
Response.Write( "Is Win32 = " + bc.Win32 + "<br>");
Response.Write( "Supports Frames = " + bc.Frames + "<br>");
Response.Write( "Supports Tables = " + bc.Tables + "<br>");
Response.Write( "Supports Cookies = " + bc.Cookies + "<br>");
Response.Write( "Supports VB Script = " + bc.VBScript + "<br>");
Response.Write( "Supports JavaScript = " + bc.JavaScript + "<br>");
Response.Write( "Supports Java Applets = " + bc.JavaApplets + "<br>");
Response.Write( "Supports ActiveX Controls = " + bc.ActiveXContr ols + "<br>");
Response.Write( "CDF = " + bc.CDF + "<br>");


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:E4******** *************** ***********@mic rosoft.com...
I just added this line of code to a simple aspx page:

HttpBrowserCapa bilities browserCap = new HttpBrowserCapa bilities();

Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all the
properties were null. How come?

--
Robert W.
Vancouver, BC
www.mwtech.com

Apr 28 '06 #2
Oh I see, it's a data structure, not a [populated] object in and of itself.
Thanks!
--
Robert W.
Vancouver, BC
www.mwtech.com

"Juan T. Llibre" wrote:
Try this :

HttpBrowserCapa bilities bc = Request.Browser ;
Response.Write( "<p>Browser Capabilities:</p>");
Response.Write( "Type = " + bc.Type + "<br>");
Response.Write( "Name = " + bc.Browser + "<br>");
Response.Write( "Version = " + bc.Version + "<br>");
Response.Write( "Major Version = " + bc.MajorVersion + "<br>");
Response.Write( "Minor Version = " + bc.MinorVersion + "<br>");
Response.Write( "Platform = " + bc.Platform + "<br>");
Response.Write( "Is Beta = " + bc.Beta + "<br>");
Response.Write( "Is Crawler = " + bc.Crawler + "<br>");
Response.Write( "Is AOL = " + bc.AOL + "<br>");
Response.Write( "Is Win16 = " + bc.Win16 + "<br>");
Response.Write( "Is Win32 = " + bc.Win32 + "<br>");
Response.Write( "Supports Frames = " + bc.Frames + "<br>");
Response.Write( "Supports Tables = " + bc.Tables + "<br>");
Response.Write( "Supports Cookies = " + bc.Cookies + "<br>");
Response.Write( "Supports VB Script = " + bc.VBScript + "<br>");
Response.Write( "Supports JavaScript = " + bc.JavaScript + "<br>");
Response.Write( "Supports Java Applets = " + bc.JavaApplets + "<br>");
Response.Write( "Supports ActiveX Controls = " + bc.ActiveXContr ols + "<br>");
Response.Write( "CDF = " + bc.CDF + "<br>");


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:E4******** *************** ***********@mic rosoft.com...
I just added this line of code to a simple aspx page:

HttpBrowserCapa bilities browserCap = new HttpBrowserCapa bilities();

Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all the
properties were null. How come?

--
Robert W.
Vancouver, BC
www.mwtech.com


Apr 28 '06 #3
re:
Oh I see, it's a data structure, not a [populated] object in and of itself.
Exactly...

re: Thanks!
You're more than welcome! Have a great week-end!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:68******** *************** ***********@mic rosoft.com... Oh I see, it's a data structure, not a [populated] object in and of itself.
Thanks!
--
Robert W.
Vancouver, BC
www.mwtech.com

"Juan T. Llibre" wrote:
Try this :

HttpBrowserCapa bilities bc = Request.Browser ;
Response.Write( "<p>Browser Capabilities:</p>");
Response.Write( "Type = " + bc.Type + "<br>");
Response.Write( "Name = " + bc.Browser + "<br>");
Response.Write( "Version = " + bc.Version + "<br>");
Response.Write( "Major Version = " + bc.MajorVersion + "<br>");
Response.Write( "Minor Version = " + bc.MinorVersion + "<br>");
Response.Write( "Platform = " + bc.Platform + "<br>");
Response.Write( "Is Beta = " + bc.Beta + "<br>");
Response.Write( "Is Crawler = " + bc.Crawler + "<br>");
Response.Write( "Is AOL = " + bc.AOL + "<br>");
Response.Write( "Is Win16 = " + bc.Win16 + "<br>");
Response.Write( "Is Win32 = " + bc.Win32 + "<br>");
Response.Write( "Supports Frames = " + bc.Frames + "<br>");
Response.Write( "Supports Tables = " + bc.Tables + "<br>");
Response.Write( "Supports Cookies = " + bc.Cookies + "<br>");
Response.Write( "Supports VB Script = " + bc.VBScript + "<br>");
Response.Write( "Supports JavaScript = " + bc.JavaScript + "<br>");
Response.Write( "Supports Java Applets = " + bc.JavaApplets + "<br>");
Response.Write( "Supports ActiveX Controls = " + bc.ActiveXContr ols + "<br>");
Response.Write( "CDF = " + bc.CDF + "<br>");


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:E4******** *************** ***********@mic rosoft.com...
>I just added this line of code to a simple aspx page:
>
> HttpBrowserCapa bilities browserCap = new HttpBrowserCapa bilities();
>
> Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all the
> properties were null. How come?
>
> --
> Robert W.
> Vancouver, BC
> www.mwtech.com
>


Apr 28 '06 #4
just remember, browsercaps just looks at the UserAgent string sent by the
browser, and lookups the values based on the string, so the browsercaps
values are not alway accurate. for example, JavaScript is true for IE, but
the user may have javascript disabled. also some browser (say opera) lie
about who they are.

-- bruce (sqlwork.com)

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:u0******** ******@TK2MSFTN GP02.phx.gbl...
re:
Oh I see, it's a data structure, not a [populated] object in and of
itself.


Exactly...

re:
Thanks!


You're more than welcome! Have a great week-end!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:68******** *************** ***********@mic rosoft.com...
Oh I see, it's a data structure, not a [populated] object in and of
itself.
Thanks!
--
Robert W.
Vancouver, BC
www.mwtech.com

"Juan T. Llibre" wrote:
Try this :

HttpBrowserCapa bilities bc = Request.Browser ;
Response.Write( "<p>Browser Capabilities:</p>");
Response.Write( "Type = " + bc.Type + "<br>");
Response.Write( "Name = " + bc.Browser + "<br>");
Response.Write( "Version = " + bc.Version + "<br>");
Response.Write( "Major Version = " + bc.MajorVersion + "<br>");
Response.Write( "Minor Version = " + bc.MinorVersion + "<br>");
Response.Write( "Platform = " + bc.Platform + "<br>");
Response.Write( "Is Beta = " + bc.Beta + "<br>");
Response.Write( "Is Crawler = " + bc.Crawler + "<br>");
Response.Write( "Is AOL = " + bc.AOL + "<br>");
Response.Write( "Is Win16 = " + bc.Win16 + "<br>");
Response.Write( "Is Win32 = " + bc.Win32 + "<br>");
Response.Write( "Supports Frames = " + bc.Frames + "<br>");
Response.Write( "Supports Tables = " + bc.Tables + "<br>");
Response.Write( "Supports Cookies = " + bc.Cookies + "<br>");
Response.Write( "Supports VB Script = " + bc.VBScript + "<br>");
Response.Write( "Supports JavaScript = " + bc.JavaScript + "<br>");
Response.Write( "Supports Java Applets = " + bc.JavaApplets + "<br>");
Response.Write( "Supports ActiveX Controls = " + bc.ActiveXContr ols +
"<br>");
Response.Write( "CDF = " + bc.CDF + "<br>");


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:E4******** *************** ***********@mic rosoft.com...
>I just added this line of code to a simple aspx page:
>
> HttpBrowserCapa bilities browserCap = new HttpBrowserCapa bilities();
>
> Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all
> the
> properties were null. How come?
>
> --
> Robert W.
> Vancouver, BC
> www.mwtech.com
>


Apr 28 '06 #5
re:
just remember, browsercaps just looks at the UserAgent string ...snip... so the browsercaps values
are not always accurate.
Unfortunately, the userAgent string is the *only* way to identify browsers.

If someone comes to my site while spoofing their userAgent,
they deserve whatever rendering problems they get.

;-)

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"bruce barker (sqlwork.com)" <b_************ *************@s qlwork.com> wrote in message
news:Ov******** ******@TK2MSFTN GP05.phx.gbl... just remember, browsercaps just looks at the UserAgent string sent by the browser, and lookups the
values based on the string, so the browsercaps values are not alway accurate. for example,
JavaScript is true for IE, but the user may have javascript disabled. also some browser (say
opera) lie about who they are.

-- bruce (sqlwork.com)

"Juan T. Llibre" <no***********@ nowhere.com> wrote in message
news:u0******** ******@TK2MSFTN GP02.phx.gbl...
re:
Oh I see, it's a data structure, not a [populated] object in and of itself.


Exactly...

re:
Thanks!


You're more than welcome! Have a great week-end!

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:68******** *************** ***********@mic rosoft.com...
Oh I see, it's a data structure, not a [populated] object in and of itself.
Thanks!
--
Robert W.
Vancouver, BC
www.mwtech.com

"Juan T. Llibre" wrote:

Try this :

HttpBrowserCapa bilities bc = Request.Browser ;
Response.Write( "<p>Browser Capabilities:</p>");
Response.Write( "Type = " + bc.Type + "<br>");
Response.Write( "Name = " + bc.Browser + "<br>");
Response.Write( "Version = " + bc.Version + "<br>");
Response.Write( "Major Version = " + bc.MajorVersion + "<br>");
Response.Write( "Minor Version = " + bc.MinorVersion + "<br>");
Response.Write( "Platform = " + bc.Platform + "<br>");
Response.Write( "Is Beta = " + bc.Beta + "<br>");
Response.Write( "Is Crawler = " + bc.Crawler + "<br>");
Response.Write( "Is AOL = " + bc.AOL + "<br>");
Response.Write( "Is Win16 = " + bc.Win16 + "<br>");
Response.Write( "Is Win32 = " + bc.Win32 + "<br>");
Response.Write( "Supports Frames = " + bc.Frames + "<br>");
Response.Write( "Supports Tables = " + bc.Tables + "<br>");
Response.Write( "Supports Cookies = " + bc.Cookies + "<br>");
Response.Write( "Supports VB Script = " + bc.VBScript + "<br>");
Response.Write( "Supports JavaScript = " + bc.JavaScript + "<br>");
Response.Write( "Supports Java Applets = " + bc.JavaApplets + "<br>");
Response.Write( "Supports ActiveX Controls = " + bc.ActiveXContr ols + "<br>");
Response.Write( "CDF = " + bc.CDF + "<br>");


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Robert W." <Ro*****@discus sions.microsoft .com> wrote in message
news:E4******** *************** ***********@mic rosoft.com...
>I just added this line of code to a simple aspx page:
>
> HttpBrowserCapa bilities browserCap = new HttpBrowserCapa bilities();
>
> Yet when I used QuickWatch in Debug mode to inspect 'browserCap' all the
> properties were null. How come?
>
> --
> Robert W.
> Vancouver, BC
> www.mwtech.com
>



Apr 28 '06 #6

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

Similar topics

7
4846
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As InternetExplorer But then I cant see when a user exit my objIExplorer and than an error will show up when I try to open a link in the IE window that does not exist... What can I do about this and way does it not work in win 98?
5
3623
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug puposes only and is not normally visable to the user.) The Thread function is actually in the Form class. Now.. What I am seeing is that when I create an instance of this Class Library's Form, which starts the worker thread, it seems to hose up...
22
2606
by: Robert Bralic | last post by:
CAN anybody tell me any address where I can download some small(1000-2000) lines C++ proghram source. Or send me ,a small(1000-2000) lines C++ program source that I can compille with gpp under Linux Suse 7.1. I can't belive that C++ exists. Thanks in advance ! robert.bralic@si.htnet.hr
12
2937
by: Frank Hauptlorenz | last post by:
Hello Out there! I have a DB2 V7.2 Database (Fix11) on Win 2000 Professional. It was before a NT 4 based Domain - now it is a Win 2000 Domain. The database server is a domain member. Now sometimes Win 2000 Clients can't connect to the database. They connect over TCP/IP. The db2log says that the function getHostByName failed. It seems to be only on new installed win 2000 Workstations. Already installed WS have NOT this problem.
2
2991
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, OS, and Version information. So I saw this great System.Web.HTTPBrowserCapabilities object which will parse the User Agent string for me and tell me everything I need. Only problem is there's no easy way to create an instance of this object...
14
4842
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it can be done using the designer but I intentionally don't want to use that. The one reason is that you cannot change the code generated by the designer. The other could be that you have more free hand and control to design your GUI. 2....
89
6035
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be used." Could anybody tell me why gets() function is dangerous?? Thank you very much. Cuthbert
14
3473
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src="" id="eventImage0" class="eventImage"><img src="" id="eventImage1" class="eventImage"></div>
4
1889
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 show a different content for search engine bots. I was planning on relying on HttpBrowserCapabilities.crawler, but what if the bot signature changes, or there is another one added, ... Thanks,
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8628
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.