By implementing IDisplayMode you can transform a virtual path pretty much in any way you want. The problem is in Views location caching, which uses the DisplayModeId to cache a location (AppendDisplayModeToCacheKey). This means the transformed path must always be the same and cannot vary depending on the HttpContext.
One use case would be a Display Mode for localization. Based on the user's browser settings, and by setting uiCulture="auto" on Web.config, you could have a display mode that transforms a path like ~/Views/Home/Index.cshtml to ~/Views/Home/Index.es.cshtml. CanHandleContext would always return true.
What I would do is add a new string property to DisplayInfo and use that in the cache key, and fallback to using DisplayModeId if null.
Comments: Hi - We have reviewed this suggestion and we feel that this feature is not well-aligned with Display Modes, which are designed to be static and finite in nature.
One use case would be a Display Mode for localization. Based on the user's browser settings, and by setting uiCulture="auto" on Web.config, you could have a display mode that transforms a path like ~/Views/Home/Index.cshtml to ~/Views/Home/Index.es.cshtml. CanHandleContext would always return true.
What I would do is add a new string property to DisplayInfo and use that in the cache key, and fallback to using DisplayModeId if null.
Comments: Hi - We have reviewed this suggestion and we feel that this feature is not well-aligned with Display Modes, which are designed to be static and finite in nature.