ASP.NET:如何在 Web 应用程序之间共享资源(成员身份、库)

发布于 2024-07-19 00:51:07 字数 587 浏览 4 评论 0原文

我正在尝试创建一个小型内部网。 为此,我在本地电脑上有一个网络服务器。 该网站的根目录将是一个仪表板,它将包含登录/注册功能(默认 ASP.NET 会员资格)。

http://localhost
http://localhost/Account

Intranet 的其余部分将由子应用程序组成,例如:

http://localhost/ApplicationName

根网站,并且大多数子应用程序将要求对我将使用默认 ASP.NET 会员提供程序的用户进行身份验证。

所有项目(根项目和子项目)都是 Visual Studio 中的单独项目, 每个项目都有自己的 用于部署的 WebSetup 项目。

1.) 如何在子应用程序中使用 ASP.NET 成员资格?

此外,大多数应用程序(根和子)将使用第 3 方库(数据框架)。

2.) 如何在根项目中引用库并在子应用程序中“使用”引用的库?

感谢您的任何建议!

i'm trying to create a small intranet. For this I have a webserver on my local pc. The root of this website will be a dashboard and it will contain login/register functionality (default ASP.NET Membership).

http://localhost
http://localhost/Account

The rest of the intranet will consist of sub-applications like:

http://localhost/ApplicationName

The root website, and most of the sub-applications will be requiring authentication of the user for which I will be utilizing the default ASP.NET Membership provider.

All the projects (root and sub) are seperate projects in Visual Studio,
and every project has it's own
WebSetup project for deployment.

1.) How can I use ASP.NET Membership in sub-applications?

Furthermore, most of the applications (root and sub) will be using a 3rd party library (data framework).

2.) How can I reference the library in the root-project and 'use' the referenced library in sub-applications?

Thank you for any suggestions!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

败给现实 2024-07-26 00:51:07

在类库项目中创建可在多个 Web 项目中使用的通用代码。 至于会员资格提供程序,我认为您需要将会员资格数据存储在外部 SQL 实例(可能位于同一服务器上)中,然后只需使用相同的连接字符串在每个项目中访问它。

Create your common code in class library projects that can be used from multiple web projects. As for the membership provider, I think you'll need to store the membership data in an external SQL instance (which could be on the same server) and then simply use the same connection strings to access it in each project.

吹梦到西洲 2024-07-26 00:51:07

会员资格旨在与一个或多个应用程序配合使用。 您可以拥有一个数据库实例(与任何应用程序的任何数据库分开),该实例可以容纳每个应用程序的成员资格数据。 如果您希望所有应用程序使用相同的成员资格数据,请在 在每个应用程序的 web.config 中定义成员身份

至于你问题的第二部分,tvanfosson 发布的答案(以及评论)应该会引导你走上正确的道路。

编辑(@ropstah Comment):啊,我没有考虑到这一点。 在这种情况下,您需要实施单点登录 (SSO)。 Masoud Tabatabaei 在 ASPAlliance.com 上发布了一篇文章,介绍了整个过程。 另外,Keith Rull这个堆栈溢出问题也可能有帮助。

Membership is designed to work with one or many applications. You can have an instance of a database (separate from any databases for any of your applications) that can house each of your applications Membership data. If you wish to have all of your applications use the same Membership data, provide an identical applicationName (and connectionString) when defining Membership in each application's web.config.

As for the second part of your question, the answer tvanfosson posted (along with the comments) should lead you on the right path.

Edit (@ ropstah Comment): Ah, I did not account for that. In that case, you'd want to implement Single Sign-on (SSO). Masoud Tabatabaei posted an article at ASPAlliance.com that walks through the process. Also, the answer provided by Keith Rull to this Stack Overflow question may help as well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文