Having separate projects in one ASP.NET MVC 5 solution

I want to have many projects (e.g. 20) in one ASP.NET solution. All projects will have their own databases, models, views, and controllers. Can you tell me how I can do this? And what will the urls look like? If the solution has one project, it looks like this:

local: 12345 / Controller / View

When there will be more projects, will such a configuration be like this ?:

local: 12345 / ProjectName / Controller / View

One more thing, I plan on using the Identity 2.0 Framework. Is it possible for a user to log in to all projects upon login once? Thanks.

+6
source share
2 answers

Can you tell me how I can do this? And how will the urls be displayed?

Your solution may have an "n" number of projects. You need to process it using RouteConfig.cs if you have three projects: "Project1", "Project2" and "Project3". Then your corresponding route configuration will look something like this:

 routes.MapRoute( name: "Default_1", url: "Project1/{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); 

Similarly

 routes.MapRoute( name: "Default_2", url: "Project2/{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); 

Is it possible for a user to log into all projects when he logs in once?

Yes, it is definitely possible. But ASP.NET authentication out of the box does not support multiple applications. Saying that this is the task of developers to achieve this Single Sign On

Link: How to implement it

Hope this helps!

+4
source

You can have as many projects in one solution that you want. Just right-click on the solution in the Project Explorer window and select "Add New Project". In the properties of each project, set its root directory as / applicationname.

You will need to learn the details of oAuth in order to implement a single sign scheme, and I really cannot help you, but this is the whole purpose of this implementation, so it is definitely possible.

+2
source

Source: https://habr.com/ru/post/985654/


All Articles