I have seen the mobile support in MVC4. I am not able to find any support for device detection. So does that mean we have still continue the use of device detection libraries(e.g. 51Degrees.mobi) to find out the request is from which device(mobile/tablet
etc)?
Yes, I think so. The browser detection should be responsible by the browser capacity. I don't see any enhancements in MVC4 for that. MVC4 by default detects if the request is from mobile or desktop and choose different views to display. You have to use your
own code to detect fine grained devices, like iPhone, android, WP7, etc.
The good part of MVC4 is that it keeps your project well organized and you don't have to write bunches of if-else or switch code for different devices. You can just separate them into different views and make them name to be different like view.cshtml, view.Mobile.cshtml,
view.iPhone.cshtml. Partial views and layout are both works in the same pattern.
Marked as answer by Nutan Jayavant on Oct 11, 2011 11:44 AM
I have seen the mobile support in MVC4. I am not able to find any support for device detection. So does that mean we have still continue the use of device detection libraries(e.g. 51Degrees.mobi) to find out the request is from which device(mobile/tablet
etc)?
Yes, I think you should use WURLF database, which gives you upto date information about mobile devices. On the other hand, ASP.NET(MVC included) depends mostly on user-agents and .browser files. I belive you already know about WURLF.NET and 51 mobile liceance
issue. You should
also see this introduction.
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
I have seen the mobile support in MVC4. I am not able to find any support for device detection. So does that mean we have still continue the use of device detection libraries(e.g. 51Degrees.mobi) to find out the request is from which device(mobile/tablet
etc)?
Yes, I think you should use WURLF database, which gives you upto date information about mobile devices. On the other hand, ASP.NET(MVC included) depends mostly on user-agents and .browser files. I belive you already know about WURLF.NET and 51 mobile liceance
issue. You should
also see this introduction.
imran_ku07 can you tell us what is the license issue between 51degree and WURLF.NET ?
"And whoever is removed away from the Fire and admitted to Paradise, he indeed is successful." (The Holy Quran)
Excellent Windows VPS Hosting Imran Baloch MVP, MVB, MCP, MCTS, MCPD
You can try using this approach, here Scott has tried to use the Browser Capabilities and then implemented the IViewEngine to implement the device detection.
Nutan Jayava...
Member
54 Points
65 Posts
Device Detection in MVC4
Oct 04, 2011 06:08 AM|LINK
Hi,
I have seen the mobile support in MVC4. I am not able to find any support for device detection. So does that mean we have still continue the use of device detection libraries(e.g. 51Degrees.mobi) to find out the request is from which device(mobile/tablet etc)?
hongyes
Member
28 Points
4 Posts
Re: Device Detection in MVC4
Oct 04, 2011 07:40 AM|LINK
Yes, I think so. The browser detection should be responsible by the browser capacity. I don't see any enhancements in MVC4 for that. MVC4 by default detects if the request is from mobile or desktop and choose different views to display. You have to use your own code to detect fine grained devices, like iPhone, android, WP7, etc.
The good part of MVC4 is that it keeps your project well organized and you don't have to write bunches of if-else or switch code for different devices. You can just separate them into different views and make them name to be different like view.cshtml, view.Mobile.cshtml, view.iPhone.cshtml. Partial views and layout are both works in the same pattern.
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Device Detection in MVC4
Oct 05, 2011 02:44 AM|LINK
Yes, I think you should use WURLF database, which gives you upto date information about mobile devices. On the other hand, ASP.NET(MVC included) depends mostly on user-agents and .browser files. I belive you already know about WURLF.NET and 51 mobile liceance issue. You should also see this introduction.
Edit: Also see this
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
vampire203
Member
400 Points
168 Posts
Re: Device Detection in MVC4
Oct 06, 2011 09:02 PM|LINK
imran_ku07 can you tell us what is the license issue between 51degree and WURLF.NET ?
imran_ku07
All-Star
45815 Points
7698 Posts
MVP
Re: Device Detection in MVC4
Oct 07, 2011 05:11 PM|LINK
http://www.scientiamobile.com/forum/viewtopic.php?f=13&t=62
Excellent Windows VPS Hosting
Imran Baloch MVP, MVB, MCP, MCTS, MCPD
MarshallVI
Member
2 Points
1 Post
Re: Device Detection in MVC4
Oct 19, 2011 02:34 AM|LINK
I think the answer you are looking for can be found here http://www.dotnetexpertguide.com/2011/09/display-mode-in-mvc-4aspnet-mvc-4.html. It looks like you can a different view based on the requesting browser with the Display Mode feature.
maggie.ying
Member
183 Points
39 Posts
Microsoft
Re: Device Detection in MVC4
Sep 18, 2012 12:15 AM|LINK
Here is the official release notes for the DisplayMode feature:
http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253810
mohanbrij
Participant
1692 Points
263 Posts
Re: Device Detection in MVC4
Feb 19, 2013 01:58 AM|LINK
You can try using this approach, here Scott has tried to use the Browser Capabilities and then implemented the IViewEngine to implement the device detection.
http://www.hanselman.com/blog/ABetterASPNETMVCMobileDeviceCapabilitiesViewEngine.aspx
Hope this will help.
Best Regards
Brij Mohan
http://www.dotnetglobe.com