与 Microsoft 的 ASP.NET Javascript Services是否可以选择哪些路线在服务器端渲染?
我需要像主页这样的营销页面在服务器上呈现以进行 SEO,但 Web 应用程序页面只能在客户端上呈现。
我正在使用react、react router和asp net core 2.0。
最佳答案
在 View 中使用asp-prerender-*,如下所述
例如,在您的 cshtml 中:
<div id="my-spa" asp-prerender-module="ClientApp/boot-server"
asp-prerender-data="new {
IsGoldUser = true,
Cookies = ViewContext.HttpContext.Request.Cookies
}"></div>
关于javascript - ASP.NET Javascript 服务服务器端渲染特定路由,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46527093/