So, i'm trying to detect mobile requests in .net 4.
I discovered the Request.Browser.IsMobile and Request.Browser.MobileDeviceModel. This works great on my windows 7 laptop dev environment. Using my iPad: IsMobile=true
, and MobileDeviceModel="IPad"
.
But when I check this on Windows 2008 Server, I'm getting IsMobile=false
, and MobileDeviceModel="Unknown"
.
After digging around for a while, I discovered these properties are fueled by xml files in the .net framework folders: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\Browsers
And then, I noticed that my laptop's Browsers\iphone.xml has ipad info, while my server's same folder and same file does not contain ipad info.
<browsers>
<gateway id="IPhone" parentID="Safari">
...
</gateway>
<gateway id="IPod" parentID="Safari">
...
</gateway>
<gateway id="IPad" parentID="Safari">
<identification>
<userAgent match="iPad" />
</identification>
<capabilities>
<capability name="isMobileDevice" value="true" />
<capability name="mobileDeviceManufacturer" value="Apple" />
<capability name="mobileDeviceModel" value="IPad" />
</capabilities>
</gateway>
</browsers>
My first though is to copy of my browser files over to the server. But I want to make sure it's safe and right to do so. Why would my laptop have these extra devices but not my server? It's the exact same .net version. And, is copying these files over the only thing I need to do?