The intention is to access a module in a controller, and that by pressing the button.
So a HelloWorld message does get printed on the screen.
The Directory Structure
- models/HelloWorldController.vb
- views/Home/FrontPage.vbhtml
- views/_ViewStart.vbhtml
- views/Shared/_Layout.vbhtml
The Example Code
FrontPage.vhtml
<h1>Cause the HelloWorld Line...</h1>
<form name="hello_world_button" action="" method="post">
<button type="button" name="button">Press it!</button>
</form>
HelloWorldController.vb
Module HelloWorld
' Every console application starts with Main
Sub Main()
System.Console.WriteLine("Hello world!")
End Sub
End Module
The Tools Used
Visual Studio 2012, Visual Basic, MVC 4
Further Addendum
For those who are wondering, here is a showcase of the intended HelloWorld application with PHP - (PHP has been my background in regards to programming)
<body>
<form action="" method="POST">
<button name="button">Press It!</button>
</form>
<?php
$button = $_POST['button'];
if(isset($button)) {
echo "Hello World Message!";
}
?>
</body>
Here is an example to have a look at: click here
The URL Routing
I am as of yet focused on "routing" and the "http" protocol system with VB.NET.
I tried the following:
<h1>Cause the HelloWorld Line...</h1>
<form name="hello_world_button" action="@Url.Action("HelloWorld", "~/~/Models/HelloWorldController.vb")" method="post">
<button type="button" name="button">Press it!</button>
</form>
The HTML action
attribute holds the url.action
command with the module name HelloWorld
and the path to the controller file.
Though, when pressing the button the message does not get printed on the screen.
Is there a way to check if the routing
has been correct?