HTML Question Regarding How to Make My Website Button Run a Batch File


I am making a website in Visual Studio. I have the front end basically completed. It is a one-page website with two buttons. When you click a button, it should run a batch file by 1) when the user clicks the button, a controller is accessed and runs a method, 2) which finally needs to run a batch file.

My question is, why isn’t this HTML:

<input type=“button” class=“DisconnectButton” value=“Disconnect” onclick="@Url.Action(“Test”, “HomeController”)" />

accessing the controller?


That’s because HTML does not execute server side code; you can embed JavaScript in HTML for executing client side code (which runs in the browser), but to run server side code, you either need to build your page in ASP, PHP, or another server side scripting language, or your batch file needs to be run as a CGI script.

Which web server software are you using, and on what operating system?


I’m using .NET in visual studio on windows 10, and I fixed it by making the button run a JavaScript function that then accessed the controller.