Login to our asp.net MVC 4 web application using Office 365 instead of local exchange RRS feed

  • Question

  • User-540818677 posted

    We have an Asp.Net MVC-4 web application, where users login to it using their active directory username and password, where we have the following Login action method:-

            public ActionResult Login(LoginModel model, string returnUrl)
                MembershipProvider domainProvider;
                domainProvider = Membership.Providers["Domain1ADMembershipProvider"];
                if (ModelState.IsValid)
                    // Validate the user with the membership system.
                    if (domainProvider.ValidateUser(model.UserName, model.Password))
                        FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                        ModelState.AddModelError("", "The user name or password provided is incorrect.");
                        List<String> domains2 = new List<String>();
                        ViewBag.Domains = domains2;
                        return View(model);
                List<String> domains = new List<String>();
                ViewBag.Domains = domains;
                return View(model);

    and here is the settings inside web.config:-

            <add name="Domain1ADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=, &#xA;            Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="Domain1ConnectionString" connectionUsername="********8" connectionPassword="********" attributeMapUsername="sAMAccountName" />
          <add name="Domain1ConnectionString" connectionString="LDAP://ad-*****roup.intra/OU=TDM,DC=ad-***group,DC=intra" />

    now we have migrated to office 365, so i want to validate the entered username/password from office 365 instead of the local active directory? so is this possible and what are the setting that need to be changed?

    Thursday, May 14, 2020 11:21 AM

All replies

  • User-474980206 posted

    Your provider is using ldap. You will need to install ldap support with your office 365 server (it’s default if graph api). Once you install ldap support, this installation should give you the connect string.

    Friday, May 15, 2020 2:36 PM