String.Compare\Browser Detect\VB

G

George

VS.NET 2002\Web\VB

This is what Request.UserAgent returns for Mozilla Firebird:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
Firebird/0.7

Is there any reason why this shouldn't work to identify a visitor using that
browser?

If String.Compare(Request.UserAgent, "firebird", True) = True Then
Code:
End If

Using Mozilla Firebird, it jumps right over it. As a test, I replaced
"firebird" with "msie," and it catches the IE browser with no problem. So
why not firebird?

I can't use browser name or browser type because it returns Netscape, not
Firebird.

Thanks,
George
 
G

George

Thanks, Eric, that did work. At a loss as to why the other one didn't work,
though.

George


Eric Lawrence said:
I think you want String.IndexOf, not String.Compare.
http://msdn.microsoft.com/library/d...f/html/frlrfsystemstringclassindexoftopic.asp

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.




George said:
VS.NET 2002\Web\VB

This is what Request.UserAgent returns for Mozilla Firebird:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
Firebird/0.7

Is there any reason why this shouldn't work to identify a visitor using that
browser?

If String.Compare(Request.UserAgent, "firebird", True) = True Then
Code:
End If

Using Mozilla Firebird, it jumps right over it. As a test, I replaced
"firebird" with "msie," and it catches the IE browser with no problem. So
why not firebird?

I can't use browser name or browser type because it returns Netscape, not
Firebird.

Thanks,
George
[/QUOTE]
[/QUOTE]
 
E

Eric Lawrence [MSFT]

String.Compare looks to see if the exact string matches (with or without the
case-sensitive flag).

The string "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5)
Gecko/20031007 Firebird/0.7" is not an exact match for the string
"firebird".

--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.


George said:
Thanks, Eric, that did work. At a loss as to why the other one didn't work,
though.

George


Eric Lawrence said:
I think you want String.IndexOf, not String.Compare.
http://msdn.microsoft.com/library/d...f/html/frlrfsystemstringclassindexoftopic.asp
--
Thanks,

Eric Lawrence
Program Manager
Assistance and Worldwide Services

This posting is provided "AS IS" with no warranties, and confers no rights.




George said:
VS.NET 2002\Web\VB

This is what Request.UserAgent returns for Mozilla Firebird:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
Firebird/0.7

Is there any reason why this shouldn't work to identify a visitor
using
that
browser?

If String.Compare(Request.UserAgent, "firebird", True) = True Then
Code:
End If

Using Mozilla Firebird, it jumps right over it. As a test, I replaced
"firebird" with "msie," and it catches the IE browser with no problem. So
why not firebird?

I can't use browser name or browser type because it returns Netscape, not
Firebird.

Thanks,
George
[/QUOTE]
[/QUOTE]
[/QUOTE]
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top