允许用户登录到Web应用程序使用Active Directory用C# [英] Allowing users to log into web application using Active Directory with C#

查看:147
本文介绍了允许用户登录到Web应用程序使用Active Directory用C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出如何让用户在公司登录到使用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.

问候,

这篇关于允许用户登录到Web应用程序使用Active Directory用C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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