使用一个Asp.net会员数据库与多个应用程序单点登录 [英] Using one Asp.net Membership database with multiple applications Single Sign On

查看:98
本文介绍了使用一个Asp.net会员数据库与多个应用程序单点登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个IIS服务器上的两个asp.net应用程序,我想使用相同的后端数据库asp_security和会员供应商。我读过的一切,我需要做两个网站CONFIGS被引用相同的应用程序名称,因为我现在做的,但我必须做一些错误的。

I have two asp.net applications on one IIS server and I would like to use the same back end asp_security database and membership provider. I've read that all I have to do is reference the same application name in both web configs as I'm doing now, but I must be doing something wrong

在每个应用程序的web.config我有这个部分。

In each applications web.config I have this section.

<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
              type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
              connectionStringName="membership"
              enablePasswordRetrieval="false"
              enablePasswordReset="true"
              requiresQuestionAndAnswer="false"
              applicationName="/"
              requiresUniqueEmail="false"
              minRequiredPasswordLength="5"
              minRequiredNonalphanumericCharacters="0"
              passwordFormat="Hashed"
              maxInvalidPasswordAttempts="5"
              passwordAttemptWindow="10"
              passwordStrengthRegularExpression=""
              />
  </providers>
</membership>

当我从应用程序中的登录并浏览到应用程序B程序B似乎并不了解我,或从应用A.任何人我的凭据任何人有任何想法我在做什么错误?

When I log in from application A and browse to application B application B doesn't seem to know anything about me or my credentials from application A. Anyone have any ideas what I'm doing incorrectly?

推荐答案

只是为了结束的缘故,我会回答我怎么没取得什么意思我原来的问题,要求的目标。

Just for closure sake I will answer how I did achieved the goal of what my original question meant to ask for.

我有一个IIS服务器上的两个asp.net应用程序。这是我的目标使它所以当用户登录到APP1他们的用户凭据将是APP2可用。配置asp.net成员资格提供只有一个什么,我一直在寻找的一步。即使这两个应用都使用相同的后端数据库,并提供我还是当我打APP2不会进行身份验证。我一直在寻找的是一个单点登录解决方案。

I had two asp.net applications on one IIS server. It was my goal to make it so when user logged onto app1 their user credentials would be available in app2. Configuring the asp.net membership provider is only one step of what I was looking for. Even if both apps were using the same back end database and provider I still wouldn't be authenticated when I hit app2. What I was looking for was a Single Sign On solution.

一旦你有两个应用程序放置在你的web配置的system.web节以下为您asp_membership数据库指向

Once you have both apps pointing at your asp_membership database by placing the following in the system.web section of your web config

<authentication mode="Forms" />
<membership>
  <providers>
    <clear/>
    <add name="AspNetSqlMembershipProvider"
              type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
              connectionStringName="membership"
              applicationName="/"
              />
  </providers>
</membership>
<roleManager enabled="true" />

确保两个具有相同的ApplicationName属性集。

make sure both have the same applicationname property set.

我使用IIS 6,所以我将其配置为自动生成两个应用程序的机器密钥。因为这两个应用程序的住在同一台机器的关键将是相同的,这是关键的部分,以使SSO工作。设置后IIS下被添加到我的web.config

I was using IIS 6 so I configured it to autogenerate a machine key for both applications. Because both of these applications live on the same machine the key would be identical, this is the critical part to making the SSO work. After setting up IIS the following was added to my web.config

    <machineKey decryptionKey="AutoGenerate" validation="SHA1" validationKey="AutoGenerate" />

这是所有有给它。这项工作完成,我可以登录到APP1,然后浏览到APP2和保持我的安全凭证。

That was all there was to it. Once that was done I could log into app1 and then browse to app2 and keep my security credentials.

感谢在正确的方向推。

这篇关于使用一个Asp.net会员数据库与多个应用程序单点登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆