What to use instead of the WebViewPage.RenderPage method in ASP.NET 5 MVC6

Given an example based on the old MVC5: Views / Shared / Index.cshtml - view for SPA application. It contains some markup and a link to the layout page:

@{ Layout = "~/Views/Shared/_Layout.cshtml"; } 

There are a number of inclusions in _Layout.cshtml that are used with the RenderPage helper:

 @RenderPage("~/Views/Shared/_ImportCssInline.cshtml") @RenderPage("~/Views/Shared/_ImportCssLinks.cshtml") 

Now in AspNet5 @RenderPage helper is not available. This was the WebViewPage / WebPageBase / WebPageRenderingBase . Now they have been replaced with RazorPage . But there is no RenderPage method in RenderPage .

What should be used instead?

ps issue

+5
source share
1 answer

I have always been successful using @Html.Partial("~/Views/Shared/_ImportCssInline.cshtml") rather than @RenderPage . Hope there will be no difference in use for you. There are also asynchronous versions of these imported products.

Since the Html property is now being introduced as an IHtmlHelper interface, I assume that direct methods have been removed in the enhancements for view IHtmlHelper .

+4
source

All Articles