Hello, I am trying to learn MVC. I first created an empty ASP.NET Core application. Then, I added a Controller.
I then added a simple view by right clicking View() - Home.cshtml
But when I run the code, it shows me Hello World!, which is present in the Startup.cs page.
When I used the following path -
This is how I have placed my files -
I am sorry for asking a basic question. I am not able to figure this out. I have used webforms before and they used to run whenever I clicked IIS Express in Visual Studio.
C#:
namespace website.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
}
I then added a simple view by right clicking View() - Home.cshtml
C#:
<h1>Hello! Welcome to the Home Page!</h1>
But when I run the code, it shows me Hello World!, which is present in the Startup.cs page.
C#:
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/", async context =>
{
await context.Response.WriteAsync("Hello World!");
});
});
When I used the following path -
This localhost page can’t be found
This is how I have placed my files -
I am sorry for asking a basic question. I am not able to figure this out. I have used webforms before and they used to run whenever I clicked IIS Express in Visual Studio.