Hi Sam,
A lot of undocumented implementations were moved into sub-namespaces (.Internal) with EPiServer 10.
See http://world.episerver.com/documentation/Release-Notes/ReleaseNote/?releaseNoteId=CMS-3762
The same feature should still be available and usable under the new namespace:
EPiServer.Web.Routing.Segments.Internal.RequestSegmentContext.CurrentContextMode
Cheers,
//Patrick
Depending on where you wanna use this code, there is an extension method called GetContextMode on RequestContext. RequestContext is usually available, so I would recommend using that method instead since it's not an internal API. Please see http://world.episerver.com/documentation/Class-library/?documentId=cms/10/D74C6A77
requestContext.GetContextMode() is exactly what i was looking for.
Thanks for your help Johan!
There is also an abstraction EPiServer.Web.IContextModeResolver registered in IOC container that can be used.
Hi,
i am working on upgrading a site from version 7.5 to version 10 and i'm struggling to work out a solution to an error i am getting. There is some code that is used to find out if the request is in preview mode which was working in 7.5 but doesn't work in version 10:
EPiServer.Web.Routing.Segments.RequestSegmentContext.CurrentContextMode == ContextMode.Preview
the problem is that RequestSegmentContext doesn't exist in EPiServer.Web.Routing.Segments in version 10 (http://world.episerver.com/documentation/class-library/?documentId=cms/10/549E82FF) so this code won't build. I have had a play around with some other options and searched online but i can't work out the correct way to determine if the request is in preview mode.
this seems like a simple & common bit of code so i'm wondering if anyone has found a way to do this in episerver 10?
cheers
Sam