Solved

Where to redirect a MVC site to mobile views

Posted on 2012-03-10
2
268 Views
Last Modified: 2012-03-14
I am working on upgrading a classic ASP site to MVC with C# and want to support mobile devices with custom views. I have found www.handsetdetection.com from another thread. They have sample code about using the various methods, but no examples of how to integrate it into a MVC site.

1. Where is the best place to detect the device and perform the redirection? Do I need to do it for every page?

2. In their examples, it shows a request object. I'm not sure how to go about building it. I'd like to get an example of how to build the request object.
0
Comment
Question by:dgerler
2 Comments
 
LVL 7

Accepted Solution

by:
markmiddlemist earned 500 total points
ID: 37705648
Have a look at http://dotnetslackers.com/articles/aspnet/Mobile-Device-Detection-and-Redirection-Using-ASP-NET-MVC.aspx

As for (2) you coulr try HttpContext.Current.Request
0
 

Author Closing Comment

by:dgerler
ID: 37720792
The articles got me thinking. I actually decided to put the detaction in Global.asax in the Session_Start method. Then I set a Session variable and check it for mobile device.

The Request took care of itself in Global.asax.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
While working on Silverlight and WCF application, I faced one issue where fault exception occurred at WCF operation contract is not getting propagated to Silverlight client. So after searching net I came to know that it was behavior by default for s…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now