Where is IdentityHostingStartup.cs? - asp.net-mvc

In VS 2022 I have ASP.NET Core Web App MVC (.NET 6). I chose "Individual Accounts" authorization type. I need to change IdentityHostingStartup.cs.
I Already added Scaffolded Item "Identity". This created the razor pages I needed. But didn't create IdentityHostingStartup.cs.
https://i.stack.imgur.com/q4IG5.png
If create it yourself it is not overridden. So please help me someone, where can I find this file?

After test, we can't find IdentityHostingStartup.cs in .net6 project.
It seems to be removed in .net6 project.

Related

Application not auto creating AccountController

I am creating an MVC project in VS2017 and in VS2015, when you create an MVC templated ASP.NET Web App, it will automatically build an account controller for you which adds register and log in functionality. It will add an AccountController.cs and ManageController.cs to controllers with the appropriate views.
But in VS2017, when I create an MVC project it doesn't add this to the project. I've tried importing the files from an old VS2015 project, but It didn't seem to work. How can I get around this? Is there a way to create a project with the account controller or did they remove that in VS2017?
You need to select some form of authentication when you create the app.
My issue/resolution was slightly different than the accepted answer. I was choosing the "Web API" template while checking the "MVC" checkbox and I DID select Individual User Accounts, but the account controller/views were still not created. It appears the Account boilerplate doesn't get generated with the Web API option, regardless of what you choose for Authentication.
Had this problem myself today creating an ASP.NET Core Web Application with identity. changing the version from ASP.NET Core 2.1 to ASP.NET Core 2.0 fixed the problem.
I am using visual studio version 15.7.6, .NET Framework version 4.7.03056
You can easily execute this command in the nuget console and your problem will be solved:
Install-Package Microsoft.AspNet.Identity.Samples -Version 2.2.0-alpha1

Visual Studio Update 2015, many options for ASP.NET MVC project missing

I just installed Visual Studio 2015 Update 1, and a lot of the configuration I was used to is missing or different. I'd like to know if these changes are due to something simple (like a package I need to install), or if it's something a little more complex.
I'm mainly using Visual Studio to create MVC apps from scratch, so before the update, I would create an empty MVC app with the "Add core references and folders for MVC" selected. Now, I can only create an empty MVC project with nothing pre-configured, or a fully scaffolded MVC app.
In the empty MVC project, there's no option to "Add Controller" when I right-click the "Controllers" folder I create. However, this option is available in the generated one.
The Add New Item menu is divided into Server-side and Client-side templates for the generated app, but it's divided into Code/Data/General/Web/etc. in the empty app. There's also an option to add an MVC View in the generated app, but there's nothing with Razor for the empty app. No .cshtml intellisense in the empty app, either.
There's a lot of functionality and options missing from the empty app that seem like they have to do with how the app is an MVC app, since they're available for the generated app. Is there a straightforward fix that will allow me to create an MVC app using Razor from an empty template?
Figured it out! I was using the ASP.NET 4.5.2 Empty Template, and choosing the ASP.NET 5 Template solved the problem.

how to add asp.net mvc templates for monodevelop

I'm on archlinux using mono 4.0.4 and monodevelop 5.9.
By following the Getting started guide I noticed there are some scaffolding options missing, I see some nuget packages for scaffolding but installing them didn't do much.
SO has these two questions :
How to get the MVC 3 or 4 template in MonoDevelop?
Developing ASP.NET MVC using MonoDevelop on MAC
The latter is for Mac and both of them are outdated As I'm talking about asp.net mvc 5 here.
searching didn't reveal anything apart from the Nuget packages I added and I can't see any addins in the add-in manager for this(prefer not to use beta or alpha addins).
So what to do to get these ?
P.S:
I know I can get them with yoeman but I like to use monodevelop, if yoeman can be integrated with monodevelop So I can see options like "model with view and controller" scaffolding(that is a CRUD ready application) then I'll do it.
I am assuming you are talking about the templates that are available in an ASP.NET MVC application when you select Add View or Add Controller. If this is not the case then please update your question with more information.
The templates listed when adding a new view or controller to an ASP.NET MVC project are taken from t4 template files (.tt) in the following folders:
AddIns\AspNet\CodeTemplates\CSharp\AddController
AddIns\AspNet\CodeTemplates\CSharp\AddView\Razor
You can add extra .tt files into this folder and they will be displayed in the Add View and Add Controller dialog.
Out of the box MonoDevelop/Xamarin Studio only has a few t4 templates available so you would need to either write your own or find some from elsewhere. SharpDevelop has more T4 templates or MVC which could probably be used but may require some modification.

How to create a new MVC 5 project using ASP.NET Identity in Visual Studio 2012?

I have downloaded "Web Tools 2013.1 for Visual Studio 2012" and installed.
Doing this has installed MVC 5. Now, when I create a new project, the project selection box is showing "ASP.NET MVC 5 empty project" as one of the option, which creates an empty project.
What I really want is to use ASP.NET Idenity, so when I select to create new MVC 5 project, it should ask me for type of authentication (like, Individual user, Organizational, No authentication, etc).
Any idea of what else I should be including the project to enable this?
Also, I tried to google about it, but there isn't much clear information.
Thanks and Regards
I don't know if I get your question right, but the type of authentication can be set when creating a new project. Just click the Change Authentication button when creating a new project

No ASP.NET MVC 5 Web Application Template on VS 2012?

I'm using Visual Studio 2012 and have just installed "Microsoft ASP.NET and Web Frameworks 2013.1 - Visual Studio".
As expected, it added the option to create an "ASP.NET MVC 5 Empty Project". The thing is, I see no way of jump-starting an already functional "base application" as I had when I was using MVC 4 (e.g. "Asp.NET MVC 4 Web Application"). I only see an empty template.
I've seen answers such as:
How can I add the MVC 5 project template to VS 2012?
Create and Run MVC 5 Project in VS 2012
Direct download link to ASP.NET MVC 5 for VS 2012
And found this article on the matter.
This is obviously not a show-stopper as I can always create the application from a scratch, but I still would like to know if it is possible to achieve that on VS 2012. Did I miss a step, or do I need VS 2013 for that? A fully functional Web application template (with authentication etc.) would be nice to dabble around MVC 5's new features or for prototyping.
After creating a new project using ASP.NET MVC 5 Empty Project, you can right click on the project, then click Add.. > New Scaffolded Item..., select MVC on the left, then MVC 5 Dependencies and choose Full dependencies from the prompt.
This will add a default layout (Views\Shared\_Layout.cshtml), Content folder, Scripts folder with bootstrap, jquery, modernizr, etc, and other things the Web Application template creates.
If you get the error "CS0103: The name 'Styles' does not exist in the current context" just add <add namespace="System.Web.Optimization"/> under <namespaces> in Views/web.config
The answer from Sean Lynch is nice but not really complete.
However there is this nice guy that took the time to prepare the template just like in Visual Studio 2013. You will get everything down to the bootstrap template and pre-configured database table for authentication.
All you need to do is change the DefaultConnection in Web.Config to you SQL Server and voila all the relevant authentication table will be created for you.
Archive of the original blog (by web.archive.org)
Update
The original blog is no longer online, but thankfully his template is still online. You can download the MVC5 Template for Visual Studio 2012 Here:
Direct link to MVC5 Template For Visual Studio 2012
And here is the excerpt from the original blog:
Installing the template is very simple, there are just two steps:
Copy it into the following folder of your computer (creating the directory structure if necessary):
%USERPROFILE%\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#\Web
Once you’ve done this, simply restart Visual Studio and you will have this template available in the dialog box to create a new project under “Visual C# > Web”.
Now you can create applications with a little more shape than the mere empty structure provided by default and enjoy the benefits of adopting Bootstrap and its responsive design, a full membership system and user authentication, bundles, filters, some content pages, etc.
You have 2 option to fix it.
Install the latest 2013 version which have MVC5 support inbuilt (VS2013 missing MVC3 and ASPX file template (ASPX templates will be added in future))
stay with 2012 update 4. Read my old article to get it fixed http://geekswithblogs.net/anirugu/archive/2013/11/28/mvc-5-in-visual-studio-2012-update-4.-how-to.aspx
I'm not using 2012 now, but rather 2013, and I see the mvc 5 template there. However, I did this a while back before I had any mvc 5 templates showing up by installing mvc 5 first. You should be able to download from http://www.asp.net/mvc/mvc5.
Also make sure your target framework is set correctly.
Then I updated the web config like this:
You have to have the correct versions of the assemblies. I googled a lot to get this info, so it should still be available if you do some research.

Resources