How to I redirect to a custom page after signin/signup with ADB2C ?
I want to populate my model and pass it to the new view after signin/signup, but it keeps redirecting to the following: https://localhost:44342/account/signupsignin
Below is my Code:
[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("/");
}
I've tried using the part thats commented out as well:
//HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/account/Register_PersonalDetails" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
This "Shows" the right URL but displays a page that says its not found. I need to pass the model through as well - How do I
- Redirect to my own custom page after signin/signup
- Pass a model to this page as well.
Thanks for any help in advance.
So I was able to figure it out.
The Response.Redirect("/") redirects to my Index ActionResult in my Home Controller, so within that ActionResult, I used the RedirectToAction to direct me to the View I wanted(Obviously there is code doing the required checks etc. first)
Maybe this isnt the right way of doing it, but it worked for me.
Thanks.