Domanda

I'm providing my ASP.NET MVC website with a mobile version. Let's say that the web site is www.mywebsite.com and the mobile version will be www.mywebsite.it/Mobile.

As first capability I would be able to identify if a mobile device is invoking www.mywebsite.com and, if it is the case, I would simply redirect the visitor to www.mysite.com/Mobile.

To do this, I integrated the 51degrees.mobi API into my website, as described in the Method 2.2 of http://51degrees.codeplex.com/wikipage?title=MVC, and I used a real iPhone to test it.

The first access to www.mywebsite.com is properly redirected to www.mywebsite.com/Mobile, and the device, the iOS and the Browser are identified. Fine, this is what I am looking for.

Unfortunately, when I had tried again to type www.mywebsite.com once more the iPhone loaded the main home page www.mywebsite.com/home without redirecting to the mobile area.

I'm quite sure that the first access worked well because it is managed by the web.config file directly.

So, what am I missing? Is this a cache or session-related issue? How can I fix it?

Regards, Marco

È stato utile?

Soluzione

Marco,

I suspect you have the firstRequestOnly property set to true which is the default. See section 2.1 of the User Guide at this link.

http://51degrees.mobi/Support/Documentation/Foundation/UserGuide.aspx

Simply change firstRequestOnly to equal false and 51Degrees.mobi will work as you require.

The default behaviour only redirects the first request because in many cases developers want to give the option for users to navigate to the standard non-mobile version of the web site.

James - 51Degrees.mobi Founder

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top