Answered by:
How to create a View (ASPX)

Question
-
User1997074450 posted
New to MVC
How to create a View (ASPX) and make it work in visual studio 2019?
Thursday, May 27, 2021 1:29 AM
Answers
-
User753101303 posted
Hi,
Which .NET version do you target? Using ASPX as your view engine is outdated and it was not carried over to ASP.NET Core. IMO just use Razor views instead. If possible you could also start with ASP.NET Core and see https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-5.0&tabs=visual-studio and you can have a look as well to Blazor or Razor Pages.
Now, if tyou REALLY wanted to, you could have a look at https://www.c-sharpcorner.com/UploadFile/0ef46a/customizing-view-engines/ to see which view engines are configured and possibly add https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.webformviewengine?view=aspnet-mvc-5.2 if missing.
- Marked as answer by An0nym0u5User Tuesday, September 21, 2021 12:00 AM
Thursday, May 27, 2021 8:28 AM -
User287926715 posted
Hi vj78,
I recommend using the Razor view engine.
Razor is very similar to how ASPX files work. ASPX files are templates, which contain literal text and some C# code that specifies where your data should appear. We execute those to generate the HTML for our application.
ASPX files have a dependency on the ASP.NET runtime to be available to parse and execute those ASPX files. Razor has no such dependencies.
Unlike ASPX files, Razor has some different design goals.You can read this article to understand.
Tutorial: Get started with Razor Pages in ASP.NET Core
Best Regards,
ChaoDeng
- Marked as answer by An0nym0u5User Tuesday, September 21, 2021 12:00 AM
Friday, May 28, 2021 8:59 AM
All replies
-
User753101303 posted
Hi,
Which .NET version do you target? Using ASPX as your view engine is outdated and it was not carried over to ASP.NET Core. IMO just use Razor views instead. If possible you could also start with ASP.NET Core and see https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-mvc?view=aspnetcore-5.0&tabs=visual-studio and you can have a look as well to Blazor or Razor Pages.
Now, if tyou REALLY wanted to, you could have a look at https://www.c-sharpcorner.com/UploadFile/0ef46a/customizing-view-engines/ to see which view engines are configured and possibly add https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.webformviewengine?view=aspnet-mvc-5.2 if missing.
- Marked as answer by An0nym0u5User Tuesday, September 21, 2021 12:00 AM
Thursday, May 27, 2021 8:28 AM -
User287926715 posted
Hi vj78,
I recommend using the Razor view engine.
Razor is very similar to how ASPX files work. ASPX files are templates, which contain literal text and some C# code that specifies where your data should appear. We execute those to generate the HTML for our application.
ASPX files have a dependency on the ASP.NET runtime to be available to parse and execute those ASPX files. Razor has no such dependencies.
Unlike ASPX files, Razor has some different design goals.You can read this article to understand.
Tutorial: Get started with Razor Pages in ASP.NET Core
Best Regards,
ChaoDeng
- Marked as answer by An0nym0u5User Tuesday, September 21, 2021 12:00 AM
Friday, May 28, 2021 8:59 AM