I am used to working with PHP in the past as well as ASP.NET MVC. Now I am trying to learn to create an ASP.NET Framework web application, from scratch. I tried creating a project in accordance with the following steps:
I clicked "ASP.NET Web Application (.NET Framework)" and then clicked the "OK" button:
I clicked on "Empty" and made sure any references are ticked off and then I hit the "OK" button once more.
Now I have been provided with this simple as possible structure in my IDE:
I know from my experience with PHP I used to be able to call backend code from within my HTML file (which is then a PHP file when I started developing in PHP). I also know from my experience with ASP.NET MVC I used to be able to reach backend code through the usage of controllers and Razor Views.
How would I achieve the same with the given template (empty ASP.NET Framework)? I know I could add like an HTML file (with controls such as buttons) and perhaps make calls using JavaScript and JSON. Would that be the way to go and if so, how would I start developing in that way?
How could I call a simple class in my HTML file? Or should I use something else than a simple HTML for doing this?
My class:
public class Sample
{
public static string Foo()
{
return "This is a foo string through C#";
}
}
My HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<!--Call the C# class foo() method-->
</body>
</html>
Folder structure: