在一个ASP.NET MVC 5解决方案中具有单独的项目

编程入门 行业动态 更新时间:2024-10-28 12:29:02
本文介绍了在一个ASP.NET MVC 5解决方案中具有单独的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在一个ASP.NET解决方案中有许多项目(例如20个).所有项目都将拥有自己的数据库,模型,视图和控制器. 你能告诉我我该怎么做吗?网址将如何?如果解决方案中有一个项目,则如下所示:

I want to have many projects(like 20) in one ASP.NET solution. All projects would have their own databases, models, views and controllers. Can you tell me how I can do that? And how the urls would be? If there is one project in the solution it is like this :

localhost:12345/Controller/View

localhost:12345/Controller/View

当有更多项目时,是否会像这样进行正确的配置? :

When there are more projects, would the correct configuration like this ? :

localhost:12345/ProjectName/Controller/View

localhost:12345/ProjectName/Controller/View

还有一件事,我打算使用Identity 2.0 Framework.用户一次登录是否可以登录所有项目?谢谢.

One more thing, I am planning to use Identity 2.0 Framework. Is it possible for a user to be logged in in all projects when he logs in once? Thanks.

推荐答案

你能告诉我我该怎么做吗?网址将如何?

Can you tell me how I can do that? And how the urls would be?

您的解决方案中可以有'n'个项目.您需要使用RouteConfig.cs来处理它,如果您有三个项目,分别是"Project1","Project2"和"Project3".然后您各自的路由配置将如下所示:

You can have 'n' number of projects in your solution. You need to handle it using the RouteConfig.cs where if you have three projects as 'Project1', 'Project2' and 'Project3'. Then your respective route config would be something like below:

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

类似地,

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 be logged in in all projects when he logs in once?

是的,这绝对是可能的. 但是开箱即用的ASP.NET Identity不支持多个应用程序.已经说过,通过

Yes, it is definetly possible. But ASP.NET Identity out of the box does not support multiple applications.Having said that it's the developers task to achieve it thru Single Sign On

链接:如何实施

希望有帮助!

更多推荐

在一个ASP.NET MVC 5解决方案中具有单独的项目

本文发布于:2023-11-06 22:16:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564820.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:解决方案   项目   ASP   NET   MVC

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!