2017-08-28 96 views
-1

如何在使用ADB2C登录/注册后重定向到自定义页面?在ADB2C登录/注册后重定向到自定义页面 - MVC

我想填充我的模型,并把它传递给登入/注册后的新看法,但它一直重定向到以下几点:https://localhost:44342/account/signupsignin

下面是我的代码:

[AllowAnonymous] 
     public void SignUpSignIn() 
     { 
      // Use the default policy to process the sign up/sign in flow 
      if (!Request.IsAuthenticated) 
      { 
       try 
       { 
        HttpContext.GetOwinContext().Authentication.Challenge(); 
        return; 
       } 
       catch (Exception ex) 
       { 

       } 

      } 

      string email = ((ClaimsIdentity)User.Identity).FindFirst("emails").Value; 

      // We do not want to use any existing identity information 
      EnsureLoggedOut(); 

      AccountRegistrationModel ARVM = new AccountRegistrationModel(); 

      ARVM = CallPersonalDetails(_registrationRepository.GetUserId(email), "English"); 

      RedirectToAction("Account", "Register_PersonalDetails", ARVM); 

      //HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/account/Register_PersonalDetails" }, OpenIdConnectAuthenticationDefaults.AuthenticationType); 



      //Response.Redirect("/"); 
     } 

我已经使用注释掉以及部分多数民众赞成尝试:

//HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/account/Register_PersonalDetails" }, OpenIdConnectAuthenticationDefaults.AuthenticationType); 

这个“显示”正确的URL,但显示一个页面,说其没有找到。我需要通过模型以及 - 我如何

  1. 重定向到我自己的自定义页面的登入/注册
  2. 后传递一个模型来此页为好。

感谢您的任何帮助提前。

回答

1

所以我才弄明白了。

Response.Redirect(“/”)重定向到我的Home Controller中的Index ActionResult,因此在该ActionResult中,我使用RedirectToAction将我指向我想要的View(显然,有代码正在执行所需的检查等。首先)

也许这不是正确的做法,但它为我工作。

谢谢。

相关问题