I just read the good article from this link which explain how we can detect mobile device in order to redirect user towards the appropriate website version :
But my problem is the following :
My existing app is for desktop and i use a default starting page (Default.aspx) and a master page. So, i plan to design a mobile version but without using of course this master page.
cheickna
Member
144 Points
96 Posts
Where puting the mobile and tablets detection code ?
Nov 05, 2012 12:38 AM|LINK
Hello,
I just read the good article from this link which explain how we can detect mobile device in order to redirect user towards the appropriate website version :
http://roopeshreddy.wordpress.com/2012/06/24/detect-requesting-device-type-and-redirect-in-asp-net/
But my problem is the following :
My existing app is for desktop and i use a default starting page (Default.aspx) and a master page. So, i plan to design a mobile version but without using of course this master page.
My default starting page is :
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Page sans titre" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server"> <% Call WriteMagazineTitle()%> </asp:Content>My question is : Where i have to put the detection code ? into my default.aspx or into my MasterPage.master.aspx ?
(........) if (bIsMobileDevice) { Response.Redirect("Mobile/Home.aspx"); } else { Response.Redirect("Desktop/Home.aspx"); }Thank's in advance
BrockAllen
All-Star
28124 Points
4997 Posts
MVP
Re: Where puting the mobile and tablets detection code ?
Nov 05, 2012 12:40 AM|LINK
If it's something you want to check on every request, then look into writing an http module (or handling BeginRequest in global.asax).
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
roopeshreddy
All-Star
20277 Points
3349 Posts
Re: Where puting the mobile and tablets detection code ?
Nov 05, 2012 03:14 AM|LINK
Hi,
You can also handle it in Session_Start event of Global.asax file!
Hope it helps u...
Roopesh Reddy C
Roopesh's Space
cheickna
Member
144 Points
96 Posts
Re: Where puting the mobile and tablets detection code ?
Nov 05, 2012 09:05 AM|LINK
Hello,
Thank you for your help.
I have another question about the location of Meta Tags i must put in header section
The problem is that global.asax is not a aspx page, so there is not header section.
Therefore, in wich page can i put theses Meta TAGs?
Last question : Is there any method to simulate the using of a mobile device to test before deploy my app?
Thanks in advance
roopeshreddy
All-Star
20277 Points
3349 Posts
Re: Where puting the mobile and tablets detection code ?
Nov 05, 2012 11:59 AM|LINK
Hi,
You can put these META tags in the Master Page! If no master page, then you may have to put these tags in all the pages!
Regarding Simulators -
http://roopeshreddy.wordpress.com/2011/10/11/apple-iphoneipad-simulator/
http://roopeshreddy.wordpress.com/2011/02/05/developing-asp-net-web-applications-for-windows-phone-7/
http://roopeshreddy.wordpress.com/2011/04/07/testing-asp-net-web-apps-in-google-android-emulator/
Hope it helps u...
Roopesh Reddy C
Roopesh's Space