Blazor — Enable Auto Reload or Hot Loading in server-side ASP.net Core App [Simple way]
In this blog post, I extend my experience in Blazor server-side auto-reload or hot-reload whatever you say.
I started to learn blazor since December 2019 and started a project named “Online Exam System” so in this project when I change anything in my code it and I go back in browser I got this …
It takes a couple of times and too boring to manually reload the page again and again whatever you change in code. All of a sudden I got a solution from StackOverflow and it worked for me. So that, I overcome the blazor manually auto-reload problem. Here is the solution :
- Copy the code
<script>
Blazor.defaultReconnectionHandler._reconnectCallback = function (d) {
document.location.reload();
}
</script>
- Paste it on _Host.cshtml file in the body section of your project, like that
It’s work when you run the project “Start Without Debugging” and change anything design or code. Then It automatically takes some seconds to auto-reload in browser.
- Done, Now Check on it. This is my second Medium Blog post if I have any mistake Let me know then. Thanks ( avoid grammar )
Happy Coding
I’m Sefat
Full-Stack Developer ( .Net )
Originally Published on : medium.com/@sefatanam/blazor-enable-auto-re..