How to add aspx views to ASP.NET in Visual Studio 2019 - asp.net

I have a project MVC 5 that uses and has many aspx engine views .aspx, I added new functionality to the controllers, however, when I click on add view only razor pages are available. Is there a component I'm missing?
I'm using Visual Studio 2019 Community edition.

It appears that newer Visual Studio versions do not allow to create ASPx (WebForms) View Engine Views:
Visual Studio 2017 - MVC Web Application Controller Add View missing ASPX rendering; only RAZOR
You can try to create the required ones (the ASPX files with the corrected directives) in older VS version and Copy/Past them into your VS 2019 project and try to compile. However, now it is necessary to use the Razor View Engine View instead.

Related

Visual studio 2013 web form and design view equivalent in Visual studio 2019?

I'm following an ASP.NET course series where the instructor uses Visual Studio 2013, and I can't figure out what the equivalent is in 2019 for the settings he uses. He creates a new ASP.NET Web Application, then picks the Empty template, but there are additional options that I can't see when creating mine, specifically the web forms box.
Web form (https://i.imgur.com/63lAKSg.png)
I tried to do the same, but when he continues he is able to "Add a web form" to the project. He creates a web form with the .aspx extension.
Web form (https://i.imgur.com/rSgtqlT.png)
He is also able to enter a design view mode, which I can't see. I can right click html or htmlcs files and open them with a web forms editor option, but at that point all the HTML items in my toolbox disappear(pointer, button, textarea, input, etc.). I tried to pick the ASP.NET Web application template as well but it didn't make a difference with my issue.
Design mode (https://i.imgur.com/q5uL2UI.png)
Or would it be better to just use VS 2013 for this course?
ASP.NET Web Forms is an old technology:
Web Forms was included in the original .NET Framework 1.0 release in 2002, as the first programming model available in ASP.NET. Unlike newer ASP.NET components, Web Forms is not supported by ASP.NET Core.
If you navigate to the ASP.Net Web Forms page, Microsoft tells you this:
Consider Razor Pages instead of Web Forms
Razor Pages is a more modern alternative for building web apps using HTML, CSS, JavaScript, and C#. Razor Pages can run on .NET Core - a high performance, cross-platform and open-source version of .NET that runs on Linux, macOS, and Windows.
If you must learn ASP.NET Web Forms, it is supported in Visual Studio 2019:
OP is requesting comparison between the "New Project" gui wizard steps, for Visual Studio 2019 (vs-2019) to pre-2019 versions. The request also has a student learning context.
Please find an example doing that for the task of creating a "Web Forms with Master" application with vs-2019 mapped to vs-2015, using:
Murach's ASP.NET 4.6 with C# 2015,
Microsoft Visual Studio Community 2019,
Visual Studio 16.4.3
The vs-2015 version has an option for the user to create a web forms with master application. The button "Web Form with Master" is routinely illustrated in books and online tutorials, walking learners through step-by-step to reach an intended result. That button is gone, the feature is not gone.
The web form with master option in vs-2019 is called "Web API" and can be enabled on the "Create New Web Application" wizard/gui screen.
"Web Web Form with Master Page" button has become in vs-2019.
Mapping Steps
See illustrations to create a Master Page ASP.NET application in vs-2019. How to enable Web API and Site.Master
With vs-2019 running, a user activates the new project gui/wizard with the following toolbar selections: File -> New -> Project...
Wizard/GUI vs-2019
Create a New Project in ~ image 3 missing ~ next ~ ASP.NET Web Application (DOT.NET) ~ ~ next ~ Configure your new project ~~ (i.e., name it, and set file system path) ~ ~ next ~ Create a new ASP.NET Web Application ~ Web Forms ~~ Add folders & core references ~~ [ Checkbox ] Web API
The resulting
The resulting
add dots to see missing image three: i stack imgur com/FpKBb png

no site master page found in mvc 4 web application visual studio 2013

i have visual studio 2013 with mvc 4. I have created all types of mvc web applications but still can't find any site.master in shared folder of VIEW as there exist cshtml files.
I have found on google that site.master can be accessed in mvc 2 visual studio 2010. can I have access here instead of cshtml files?
Site.Master is designed for ASP.NET WebForms and it is no longer a standard in ASP.NET MVC.
The alternative for a "site.master" is the default file "_Layout.cshtml" which is found in "Views\Shared".
As for using .master (which means you want to use ASP Controls instead of RAZOR engine) then I'd recommend not to use MVC at all since that will simply mess up your overall code and with no benefits.

Visual Studio and CMS?

I have to create an MVC asp.net website using MS visual studio for my final year of study in Information Systems. I want to know if it's possible to sort of "connect" the code to an HTML drag-and-drop CMS, instead of using visual studio's html/css editor and the auto-generated files in the mvc project.
Basically, I want to write the controller and model code in visual studio and the view code (HTML) in a nice CMS such as wordpress or drupal (not necessarily those two).
Please advise!
Consider Orchard CMS - it is ASP.net MVC based. It is supported on Azure. Here's an azure+orchard tutorial to get you up and running. Umbraco v6 released in January 2013 also supports MVC.

ASP.NET Add Razor page in Web Application not Web Site, NO MVC

I just found a strange thing in Visual Studio 2010.
I can add a Razor page into a Web Site project, but I cannot do it in a Web Application project.
I do know I can create a ASP.NET MVC(1-4) project which allows me to add a Razor page into it.
After I checked the differences between Web Site(WS) project and Web Application(WA) project, it seems to me that WA is to trend to be in most cases and has more features than WS.
So my question is:
Visual Studio 2010 allows us to add a Razor page into a WS project(you can find it when adding a new page in the list of templates), but why it does not provide the Razor page in the template in the WA project?
I'm curious about it. Waiting for your answers :)
Cheers
I had the same problem when creating a new, Empty web application. I wanted to use MVC. Despite adding the references required, it still won't let me create files by right clicking on a folder.
However, if you have SP1 installed on Visual Studio 2010, you can:
Right Click > Add > New from Template> Razor MVC View
Hope this helps.

How do you force Visual Studio 2008 to generate designer.cs e.g. Whatever.aspx.designer.cs

I have some webforms in an Asp.Net V2.0 generated using Visual Studio 2005 using Web site technology
Want to import them in to Visual Studio 2008 set to v3.5 (Asp.Net MVC) - where I use Project technology
I'm using Add > Existing Item - Which brings in Whatever.aspx & Whatever.aspx.cs
There is no Whatever.aspx.designer.cs to import
How do you force it to be generated ?
Right-click your aspx file and select Convert to Web Application.
You have to make sure that your project is a Web Application (and not a Website). Then, You can right-click on the file or the project and select "Convert to Web Application". If all goes well, the designer file will be created. If not, then there is a parsing error in the page.
But if you want your project to truly be a MVC application, then you should not be using code-behind files for your webpages (Views), so you need to refactor the codebehind classes into Controllers. See this article why not:
http://stevesmithblog.com/blog/codebehind-files-in-asp-net-mvc-are-evil/

Resources