Tuesday, 15 February 2011

asp.net - Control the flow of ViewEngines -



asp.net - Control the flow of ViewEngines -

having custom view engine installed on web app:

viewengines.engines.insert(0, new customviewengine1()); ...and sec default mvc view engine razor

and having definition of first view engine:

public class customviewengine1: razorviewengine { public customviewengine1(): this(null) { } public customviewengine1(iviewpageactivator viewpageactivator) { viewlocationformats = new string[] { "~/views/{1}/{0}.cshtml", "~/../framework.web/views/{1}/{0}.cshtml", "~/views/shared/{0}.cshtml", "~/../framework.web/views/shared/{0}.cshtml" }; masterlocationformats = new string[] { "~/views/{1}/{0}.cshtml", "~/../framework.web/views/{1}/{0}.cshtml", "~/views/shared/{0}.cshtml", "~/../framework.web/views/shared/{0}.cshtml" }; partialviewlocationformats = new string[] { "~/views/{1}/{0}.cshtml", "~/../framework.web/views/{1}/{0}.cshtml", "~/views/shared/{0}.cshtml", "~/../framework.web/views/shared/{0}.cshtml" }; fileextensions = new string[] { "cshtml" }; } protected override iview createpartialview (controllercontext controllercontext, string partialpath) { if (controllercontext.requestcontext.httpcontext.request.browser.ismobiledevice) { homecoming base.createpartialview(controllercontext, partialpath); } else { //...what have set here in order allow command next route engine in collection viewengines.engines } } protected override iview createview (controllercontext controllercontext, string viewpath, string masterpath) { if (controllercontext.requestcontext.httpcontext.request.browser.ismobiledevice) { homecoming base.createview(controllercontext, viewpath, masterpath); } else { //...what have set here in order allow command next route engine in collection viewengines.engines } } }

how finish code (where have comments ) in order if request has been not made mobile device, uses view engine comes next in viewengines collection? (which default mvc razor view engine).

thanks in advance.

regards.

jose

maybe blog post starting point you: a improve asp.net mvc mobile device capabilities viewengine

asp.net asp.net-mvc-3

No comments:

Post a Comment