Azure-Samples/active-directory-dotnet-webapp-openidconnect

Published to IIS such that the site is not deployed at the root level and after login the user is redirected to the root url instead of the site url

Closed this issue · 1 comments

I published the sample to IIS such that the site is not deployed at the root level. e.g. https://server/sites/sample and user is redirected to the root url (https://server) instead of the site url (https://server/sites/sample)

I could be wrong but it looks like the issue occurs because of Redirect url is specified as the root url "/"
public void SignIn()
{
// Send an OpenID Connect sign-in request.
if (!Request.IsAuthenticated)
{
HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = "/" }, OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
}

Indeed, you would need to change the Redirect URI, both in the code, and in the App registration for the application