
Es un método innovador para convertir una aplicación ASP.NET Core en una aplicación de una sola página, el objetivo es reducir el esfuerzo del desarrollador mientras trabaja en la creación de un SPA y mejorar el rendimiento del software tanto en el lado del servidor como en el cliente.
Las aplicaciones de una sola página son más capaces de disminuir el tiempo de carga de las páginas y la cantidad de transferencia de datos del servidor al cliente. Por qué ? Hay varios puntos débiles mientras se trabaja con el marco JavaScript como AngularJS, React, VueJS, Knockout, Meteor, etc. en una aplicación MVC Core ASP.NET para crear una aplicación de una sola página.
Descargue el archivo JS desde aquí y póngalo en el directorio JS en la carpeta wwwroot
Reemplace el archivo "_viewstart.cshtml" con
@{
if (Context.Request.Headers["X-Requested-With"] == "XMLHttpRequest")
{
Context.Response.Headers["Location"] = Microsoft.AspNetCore.Http.Extensions.UriHelper.GetDisplayUrl(Context.Request);
Context.Response.Headers["Cache-Control"] = "no-store";
}
else
{
Layout = "_Layout";
}
}
Agregue la referencia del archivo ajxnetcore.js en el archivo "_layout.cshtml"
<script src="~/js/ajxnetcore.js"></script>
Pon el renderbody () dentro de un div con una identificación como esta
<div id="myid">@RenderBody()</div>
Finnaly Agregue las siguientes líneas solo antes de la etiqueta de cuerpo de cierre
<script>
$(function() {
$('#myid').ajxnetcore();
})
</script>
Puede probar este proyecto descargando el proyecto AJXNETCORE.DEMO

El proyecto está bajo licencia MIT
Copyright (c) 2017 Amine Smahi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.