Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Is there a way to detect BlackBerry Model in asp.net,

I have made some search on the net but i have not find a solution

I try to use userAgent information , but it seem's that the format change from one version to another,

for exemple for BlackBerry 8900 ,
Request.UserAgent = "BlackBerry8900/5.0.0.681 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/-1"


for BlackBerry Torche :
Request.UserAgent = "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-GB) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.141 Mobile Safari/534.1+"


Thank's in advance for your Help
Posted
Updated 4-Jan-11 6:00am
v2

You can just use string.Contains to see if the agent has 'Blackberry' within it

Something like..

C#
string agent = Request.UserAgent;
if (agent.ToLower().Contains("blackberry"))
{
    // whatever
}



This should tell you that the client is using a blackberry device, but nothing more specific than that. Is that what you wanted?

Edit after Comment:

Possibly look into the 51degrees mobile device detection project which uses the WURFL device database

http://51degrees.codeplex.com/releases/view/50532[^]

http://51degrees.codeplex.com/documentation[^]

This should allow you to determine device models without having to add lots of string parsing
 
Share this answer
 
v3
Comments
Mouadh TRABELSI 4-Jan-11 12:07pm    
My problem is how to detect BlackBerry Model, not to detect if the device connected is Blackberry
Dylan Morley 4-Jan-11 12:17pm    
Please see my updated answer
Manfred Rudolf Bihy 4-Jan-11 12:36pm    
Good one! 5+
This is really an issue of the browser running on the BlackBerry. You would need to know what browsers are available for BlackBerrys and research there.

May we all know why you need the exact model description?
 
Share this answer
 
v2
Comments
Mouadh TRABELSI 4-Jan-11 12:09pm    
I need blackberry model, because in my asp.net mobile application , the page layout and CSS must be updated from one model to another
Manfred Rudolf Bihy 4-Jan-11 12:28pm    
I see, that is what I had suspected. Look at Manas answer on this page, it looks promising. Cheers!
 
Share this answer
 
Comments
Manfred Rudolf Bihy 4-Jan-11 12:37pm    
Good one!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900