asp.net mvc - remote Layout cshtml -


in asp.net mvc 1 can use following property assign local layout page:

@{     layout = "~/views/shared/_layout.cshtml"; } 

with local mean needs reside in same asp.net mvc project.

in our project need able share 1 layout page accross different solutions deployed different teams @ different times. need able assign layout page central location @ runtime. don't want have latest layout page , put in projects + deploy.

it not possible assign remote url layout property (which seems logical). has ever tried this?

i thinking of making alternative layout extension method following (e.g. this.setremotelayout("[url]"):

  • synchronous cached http request fetch layout page central web application
  • downloading layout page locally can accessed relative path e.g. "~/views/temp/_layout.cshtml"
  • internally assigning layout property relative path of downloaded file

has ever done this?

we going follow next pattern:

  • a central dll installed in gac html helpers (managed frameworking team)
  • a local layout page (managed normal teams) call html helper render entire layout
  • we define/render generic sections within html helpers

==> if layout needs change central dll html helper code adapted , deployed. applications automatically using updated layout without having redeploy applications.

this how can define sections within html helpers:

    public static ihtmlstring rendersectioncustom(this htmlhelper html)     {         webviewpage page = html.viewdatacontainer webviewpage;         var section = page.rendersection("customtop", false);         return section == null ? mvchtmlstring.empty : mvchtmlstring.create(section.tohtmlstring());     }      public static ihtmlstring definesectioncustom(this htmlhelper html)     {         webviewpage page = html.viewdatacontainer webviewpage;          page.definesection("customtop", () =>         {             page.write(mvchtmlstring.create(" hello world (custom top section html helper)!"));         });          return mvchtmlstring.empty;     } 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -