How to fix Page Not Refreshing After Changes
By FoxLearn 2/18/2024 9:33:35 AM 906
This post shows you How to fix .NET Core MVC Page Not Refreshing After Changes.
asp.net core live reload
By default, If you are not only explicit in the 'Development' environment then the Razor View is compiled and you will not see any changes made to .cshtml file.
cshtml changes not showing
In ASP.NET Core 2.2 you can add a configuration to your Startup class as shown below.
services.AddMvc().AddRazorOptions(options => options.AllowRecompilingViewsOnFileChange = true);
But, In ASP.NET Core 3.0 you should install the Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation from Manage Nuget Packages, then add a configuration to your Startup class as shown below.
services.AddControllersWithViews().AddRazorRuntimeCompilation();
Another way to separate project
if(HostingEnvironment.IsDevelopment()){ services.AddMvc().AddRazorOptions(o => { o.FileProviders.Add(new PhysicalFileProvider(PATH_TO_PROJECT)); }); }
Through this c# example, i hope so you can fix ASP.NET Razor views are not updating when simply updating html or asp.net mvc view not updated if only .cshtml changed.
- How to securely reverse-proxy ASP.NET Core
- How to Retrieve Client IP in ASP.NET Core Behind a Reverse Proxy
- Only one parameter per action may be bound from body in ASP.NET Core
- The request matched multiple endpoints in ASP.NET Core
- How to Create a custom model validation attribute in ASP.NET Core
- How to disable ModelStateInvalidFilter in ASP.NET Core
- How to fix LoginPath not working in ASP.NET Core
- Synchronous operations are disallowed
Categories
Popular Posts
Portal HTML Bootstrap
11/14/2024
Carpatin Admin Dashboard Template
11/17/2024
Admin BSB Free Bootstrap Admin Dashboard
11/14/2024