I managed to set up simple mobile detection using Request.Browser.IsMobile device it works 100% fine on localhost and on my mobile phone. (I can acccess localhost on my smartphone) The website formats to the screen size, however once I uploaded it to my
actual host it does not work! The mobile page does not load for the smartphone!
You may want to consider taking a look at 51Degree's "Foundation" project (also called the 51Degrees.Mobi project) , which greatly enhances the Mobile detection features available in .NET and is actually recommended by ASP.net as it provides better
detection for more recent devices.
You can read more about the Foundation project and download it here.
Some of the popular mobile devices/browsers won’t be detected using this way because ASP.NET browser files are not supported in Opera Mobile or Android devices. That means if you request "default.aspx" from Opera mobile browser, it won't redirect to "default_mobile.aspx"
You can fix this problem using 51Degrees.Mobi package.
I tried this, does not work properly for me. The classic way in asp.net as seen on code project works for me, well it clearly works on my Samsung galaxy S2 and xperia mini pro the LAYOUT changes a redirect is not made just the layout page changes, however
it does not work on my main domain, only works on localhost for an odd reason.
if (Request.Browser.IsMobileDevice){
Layout = "~/rcLayouts/_rctcg.mobile.cshtml";
}else{
Layout = "~/rcLayouts/_rctcg.cshtml";
}
On localhost the layout changes without any issues, even on my Samsung on my main domain it does not work, it does not change the layout page. I tried 51 degrees and the settings but that always redirected to /mobile/default.aspx even though I changed the
settings..
CriticalErro...
Member
421 Points
390 Posts
Weird Issue with Mobile detection
Jan 15, 2013 09:48 PM|LINK
I managed to set up simple mobile detection using Request.Browser.IsMobile device it works 100% fine on localhost and on my mobile phone. (I can acccess localhost on my smartphone) The website formats to the screen size, however once I uploaded it to my actual host it does not work! The mobile page does not load for the smartphone!
My Site | My Blog
Rion William...
All-Star
26554 Points
4414 Posts
Re: Weird Issue with Mobile detection
Jan 15, 2013 10:43 PM|LINK
You may want to consider taking a look at 51Degree's "Foundation" project (also called the 51Degrees.Mobi project) , which greatly enhances the Mobile detection features available in .NET and is actually recommended by ASP.net as it provides better detection for more recent devices.
You can read more about the Foundation project and download it here.
Angie xu - M...
All-Star
18045 Points
1550 Posts
Microsoft
Re: Weird Issue with Mobile detection
Jan 17, 2013 07:00 AM|LINK
Hi CriticalError
Some of the popular mobile devices/browsers won’t be detected using this way because ASP.NET browser files are not supported in Opera Mobile or Android devices. That means if you request "default.aspx" from Opera mobile browser, it won't redirect to "default_mobile.aspx"
You can fix this problem using 51Degrees.Mobi package.
Install 51Degrees
Step 1: Open NuGet Package Manager
Step 2: Install 51Degrees
Step 3: Define 51Degrees Configuration Section
Step 4: Define 51Degrees/wurfl
For reference - http://www.codeproject.com/Articles/213825/ASP-net-Mobile-device-detection
hope it helps you,
Kind regards
Feedback to us
Develop and promote your apps in Windows Store
CriticalErro...
Member
421 Points
390 Posts
Re: Weird Issue with Mobile detection
Jan 18, 2013 10:50 PM|LINK
I tried this, does not work properly for me. The classic way in asp.net as seen on code project works for me, well it clearly works on my Samsung galaxy S2 and xperia mini pro the LAYOUT changes a redirect is not made just the layout page changes, however it does not work on my main domain, only works on localhost for an odd reason.
My Site | My Blog
wavemaster
Participant
1279 Points
1125 Posts
Re: Weird Issue with Mobile detection
Jan 19, 2013 12:00 AM|LINK
Can you share your code?
Have you tried messing with Fiddler? Is there a mobile version?
CriticalErro...
Member
421 Points
390 Posts
Re: Weird Issue with Mobile detection
Jan 19, 2013 09:53 AM|LINK
Don't know what fiddler is,
if (Request.Browser.IsMobileDevice){ Layout = "~/rcLayouts/_rctcg.mobile.cshtml"; }else{ Layout = "~/rcLayouts/_rctcg.cshtml"; }On localhost the layout changes without any issues, even on my Samsung on my main domain it does not work, it does not change the layout page. I tried 51 degrees and the settings but that always redirected to /mobile/default.aspx even though I changed the settings..
My Site | My Blog
Angie xu - M...
All-Star
18045 Points
1550 Posts
Microsoft
Re: Weird Issue with Mobile detection
Jan 21, 2013 02:32 AM|LINK
Hi CriticalError
First you could follow what I mentioned above about ASP.NET mobile device detection, and check whether it's helpful to you.
Moreover, you could also check whether you deploy your mobile application properly,
For reference - deploying Windows mobile applications,
http://msdn.microsoft.com/en-us/library/bb158580.aspx
hope it helps you,
Kind regards
Feedback to us
Develop and promote your apps in Windows Store