ASP.NET 5 Website (Razor) -


i'm building angular app powered web api in vs2015 , asp.net 5.

in previous version of asp.net possible serve cshtml pages in lieu of html pages, without having construct mvc controllers , routes. example if created asp.net web pages (razor) project.

basically go localhost/index.cshtml , assuming had had @datetime.now.tostring() on page return white page date on it.

i want serve client markup via cshtml opposed html static filed because i'd leverage of convenient server-side stuff taghelpers.

is possible of beta8 asp.net 5?

it possible translate every page string. used email templates. can setup own route generic controller or create own middleware.

with code van generate view string

 renderviewtostring(@"/views/email/activateemail", new activateemail() { emailaddress = user.email, callback = callbackurl })   public async task<string> renderviewtostring<tmodel>(string view, tmodel model)     {         var viewengineresult = _compositeviewengine.findview(_actioncontext, view);         var viewdata = new viewdatadictionary<tmodel>(new emptymodelmetadataprovider(), new modelstatedictionary())         {             model = model         };         using (var sw = new stringwriter())         {             var viewcontext = new viewcontext(                 _actioncontext,                 viewengineresult.view,                 viewdata,                 new tempdatadictionary(new httpcontextaccessor(), new sessionstatetempdataprovider()),                 sw,                 new htmlhelperoptions());             await viewengineresult.view.renderasync(viewcontext);             return sw.tostring();         }     } 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -