How do i detect the mobile browser and redirect to mobile site in web.config file of asp.net in my web application .please do help me if any one has answer
i have only access of web.config file and i am only alow to change web.config file so please give me the code that works by changing in web.config file only..
i have only access of web.config file and i am only alow to change web.config file so please give me the code that works by changing in web.config file only..
problem is that i have only access of web.config file so if u have any solution so please do let me know
As far as I know, you may need to use some third party components for mobile browser. You may find some useful information in this
thread. Following is the main code mentioned in this thread.
<redirect firstRequestOnly="true"
mobileHomePageUrl="~/Mobile/Default.aspx"
timeout="20"
devicesFile="~/App_Data/Devices.dat"
mobilePagesRegex="/[Apple|RIM|Nokia|Mobile]/">
<locations>
<!--Send iphone to their own home page.-->
<location url="~/Apple/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="Apple"/>
</location>
<!--Send blackberry to their own home page.-->
<location url="~/RIM/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="RIM"/>
</location>
<!--Send nokia to their own home page.-->
<location url="~/Nokia/Default.aspx">
<add property="MobileDeviceManufacturer" matchExpression="Nokia"/>
</location>
</locations>
</redirect>
Please remember to click “Mark as Answer” on the post that helps you and to unmark it if a marked post does not actually answer your question.
Thank you!
----------------------
"Microsoft Community Contributor Award 2011"
nishidpancha...
0 Points
4 Posts
how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 01:21 PM|LINK
How do i detect the mobile browser and redirect to mobile site in web.config file of asp.net in my web application .please do help me if any one has answer
akshay22
Participant
944 Points
189 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 01:30 PM|LINK
Please check the link below. It's a common question being answered already.
http://www.codeproject.com/Articles/143115/ASP-NET-Mobile-Handset-Detection-Redirection-Devel
Thanks,
My Blog: Akshay's Notion
Rajneesh Ver...
All-Star
38344 Points
6989 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 01:31 PM|LINK
Try as:
www.rajneeshverma.com
Keep Forums Clean || Use Alert Moderators.
nishidpancha...
0 Points
4 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 01:35 PM|LINK
i have only access of web.config file and i am only alow to change web.config file so please give me the code that works by changing in web.config file only..
nishidpancha...
0 Points
4 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 01:35 PM|LINK
i have only access of web.config file and i am only alow to change web.config file so please give me the code that works by changing in web.config file only..
akshay22
Participant
944 Points
189 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 01:59 PM|LINK
I don't feel that only the web.config change will do your job. There has to be a code change or alternatively use javascript.
http://jonathonhill.net/2011-10-06/detecting-mobile-browsers-via-javascript/
My Blog: Akshay's Notion
nishidpancha...
0 Points
4 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 09, 2012 02:05 PM|LINK
problem is that i have only access of web.config file so if u have any solution so please do let me know
Sage Gu - MS...
Contributor
6693 Points
578 Posts
Microsoft
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 16, 2012 05:51 AM|LINK
Hi nishidpanchal,
As far as I know, you may need to use some third party components for mobile browser. You may find some useful information in this thread. Following is the main code mentioned in this thread.
<redirect firstRequestOnly="true" mobileHomePageUrl="~/Mobile/Default.aspx" timeout="20" devicesFile="~/App_Data/Devices.dat" mobilePagesRegex="/[Apple|RIM|Nokia|Mobile]/"> <locations> <!--Send iphone to their own home page.--> <location url="~/Apple/Default.aspx"> <add property="MobileDeviceManufacturer" matchExpression="Apple"/> </location> <!--Send blackberry to their own home page.--> <location url="~/RIM/Default.aspx"> <add property="MobileDeviceManufacturer" matchExpression="RIM"/> </location> <!--Send nokia to their own home page.--> <location url="~/Nokia/Default.aspx"> <add property="MobileDeviceManufacturer" matchExpression="Nokia"/> </location> </locations> </redirect>Regards,
Sage Gu - MSFT
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
santa_1975
Star
8574 Points
1499 Posts
Re: how to detect mobile browser and redirect code in web.config file in asp.net
Jul 16, 2012 06:01 AM|LINK
Hi,
Use "HTTP_User_Agent" to detect the mobile device from which the request is initiated. Refer to the article below for more information.
http://www.codeproject.com/Articles/34422/Detecting-a-mobile-browser-in-ASP-NET
Hope this helps.
Thank you!
----------------------
"Microsoft Community Contributor Award 2011"