2

I am currently working on an ASP.NET MVC webshop that must be optimized for mobile devices, especially tablets and smartphones. This is for our client at work, but I am doing a little research on ASP.NET MVC Device Detection at home. I created a little application with it and it seems to work just fine. I love the way that everything is separated nicely by using different views for every device type.

The thing I am struggling with now, is wheter to use the ASP.NET MVC Device Detection for that webshop too, or use a client-side responsive framework, like Bootstrap. I am struggling with that decision, because the ASP.NET MVC Device Detection doesn't seem really "grown-up" to me. There is not much to find about it on the internet and it only supports mobile views by default, no tablet views or anything else.

The other reason why I'm hesitating about Device Detection is because the standard ASP.NET MVC library with mobile device user agent strings is probably not going to be updated, so when new devices come out (and they do), the webshop is showing the desktop view, while we have a nice optimized view for mobile devices. Of course there are services for up-to-date device detection, like 51Degrees.mobile, but they are very expensive. (the free version has no support for detecting tablets)
I've found a way to create different views for tablets by using the example in this post, but that example uses a regex to detect smartphones and tablets, which is of course going to be outdated at some time as well.

On the other hand we have the client-side responsive solution (Bootstrap). The disadvantage of a client side responsive site is that the diffent viewmodes are not seperated. The HTML is not optimized for the device. The website is just kind of "throwing in" the desktop version and the browser adjusts the HTML page using the CSS media queries. The code is not as clean as it is with the Device Detection solution.

The quick question: is there any free or less expensive way to use the ASP.NET MVC Device Detection? Is it going to fit our needs over time? Will it not be outdated at some point?

I would really appreciate to hear what you think is the best choice in this case. Thanks in advance.

avb
  • 1,558
  • 1
  • 14
  • 37
  • When I pull 51degrees in nuget, there doesn't seem to be any charge. Have you tried installing the nuget package rather than going to their website? http://51degrees.codeplex.com/license – tintyethan May 30 '14 at 19:05
  • Indeed there is a free version, but, like I said, unfortunately that version does not detect tablets, while the tablet size is the most important size in this case. Thank for your suggestion tho. Appreciate your effort! – avb May 30 '14 at 19:48

2 Answers2

3

The entire point of responsive design is that it is device-independent. Device detection in MVC, as far as I remember, began with some rather old IIS Browsercap technology that is quite out of date.

There are far too many form factors out there to keep up with now that Android phones range in size from four to 6.5 inches and beyond. Going with a responsive design framework such as Bootstrap will allow you to target resolutions, not devices. The majority of modern smartphones and mobile browsers (even IE!) will render a responsive design consistently.

Dave Swersky
  • 34,502
  • 9
  • 78
  • 118
  • Thanks for your answer. I used the Device Detection in a (kind of) device-independent way. I created three view types: one for desktops, tablets and for smartphones. (That is _Layout.cshtml; _Layout.tablet.cshtml; _Layout.mobile.cshtml) The issue with different screen sizes is handled by using CSS in a way that it corresponds with the browser size (using percentage widths). This all works pretty good, but the main question I have is: will this be outdated at some point? And if so, how soon would that be? In 5 years or in a month? Are you saying I'd better go for the Bootstrap-solution? – avb May 30 '14 at 08:06
  • 1
    Like Dave said, device detection already is outdated. I don't want a blown up mobile layout on my six inch phone, ik want a design that fits that screen. – CodeCaster May 30 '14 at 13:00
  • 1
    The one thing device detection could be good for is serving a separate mobile version of the site *first*. Many sites do this and provide a "full site" link at the bottom for users of larger smartphones/phablets/tablets. – Dave Swersky May 31 '14 at 01:51
1

You should be using device detection with responsive design. The fact that the browser is under X pixels wide does not mean the user is on a mobile device or that they prefer to see a mobile version of the site.

Using both detection methods allows you to give the user more options and more precisely offer the best experience.

ismobiledevice ships with .net and is available freely to your asp.net mvc app.

http://msdn.microsoft.com/en-us/library/system.web.configuration.httpcapabilitiesbase.ismobiledevice(v=vs.110).aspx

tintyethan
  • 1,772
  • 3
  • 20
  • 44
  • Thanks for your answer. I know IsMobileDevice is shipped with .NET, but the question is: Will the Device Detection (user agent string) library be outdated some time? What if some company decides to make smartphones and give them another user agent string? Also: What do you mean precisely by using both responsive (client) design **and** device detection? Thanks in advance! – avb May 30 '14 at 07:52