允许用户登录到Web应用程序使用Active Directory用C#用户登录、应用程序、Directory、Web

2023-09-09 21:43:07 作者:时光如水夜微凉

我试图找出如何让用户在公司登录到使用AD的Web应用程序。我已经看过一些网站上,并在MSDN网站上关于这一点,但它没有让我连接。我想知道是否有我丢失的东西。我跑在我的本地开发这个应用程序,想看看如果AD解决方案的工作,但返回服务器拒绝回应。 无法建立与服务器的安全连接。我试图登录使用我的网络凭据,和域。

I am trying to work out how to allow users in the company log into a web application using AD. I have looked on some sites, and the MSDN site about this, but it is not allowing me to connect. I am wondering if there is something I am missing. I am running this application on my local development machine, trying to see if the AD solution is working, but returns a server denied response. "Unable to establish secure connection with the server". I am trying to log on using my network credentials, and the domain.

下面是正在使用的web.config设置:

Here is the web.config settings being used:

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
</authentication>
<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>
<membership defaultProvider="MyADMembershipProvider">
  <providers>
    <add
       name="MyADMembershipProvider"
       type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, 
         Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
       connectionStringName="ADConnectionString"
       connectionUsername="mydomain\username"
       connectionPassword="mypassword"/>
  </providers>
</membership>

我是否有别的特殊的设置,或者我应该能够在Visual Studio本地调试,而这在网络上,它可以让我正确验证。任何意见或明确的指导将大大AP preciated。这是一个带新的话题,所以全新的我。

Do I have to have something else special to setup, or should I be able to debug this locally in Visual Studio while on the network, and it will allow me to authenticate properly. Any advice or clear guidance would be greatly appreciated. This is a band new topic, so completely new to me.

推荐答案

正如我在我的评论中提到,你需要完成几个步骤来得到这个工作。我重视的图像快速浏览。

As I mentioned in my comment you need to complete a few steps to get this to work. I have attached an image with a quick overview.

这将在本地工作,但你可能需要申请在IIS中的一些变化,当您上传到生产环境。

This will work locally but you may need to apply some changes in IIS when you upload to production environment.

问候,