Frage

Is it possible to alter the 'DisplayModeProvider.Instance.Modes' collection in ASP.NET 4 WebForms? I want to alter the behaviour of 'Microsoft.AspNet.FriendlyUrls' to only redirect to a '.mobile' version of a page if the user agent contains 'iPhone'. I was given this code by Scott Hanselman but I can't get it working in ASP.NET 4 WebForms.

Placed in 'Application_Start'.

DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iPhone")
{
    ContextCondition = ctx => ctx.GetOverriddenUserAgent().Contains("iPhone")
});

Any help is much appreciated!

War es hilfreich?

Lösung

I've been informed by a higher power that this is not possible with WebForms. My answer to this was to revisit my previous question which I have now solved...

ASP.NET FriendlyUrls API - Customising what is classed as a mobile device

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top