Identityserver4: How to change login/error routes to something else

Created on 9 Mar 2016  路  7Comments  路  Source: IdentityServer/IdentityServer4

Hi,
Perhaps this is a silly question or is already answered somwhere in the docs but i cant seem to find how to change the default ui/login or ui/error routes to some other value (account/login)?

Thank you

question

Most helpful comment

Yep.

All 7 comments

Those are all under the control of the host. In the sample, that's controlled by the CustomViewLocationExpander.

The CustomViewLocationExpander lets you change the location of the views within the project, how can we go about changing the url that is in Constants.RoutePaths.Error. Currently whenever I get an error I still get redirected to http://localhost/ui/error (rather than http://localhost:55134/customerrorurl)

Is there any plans to make this customisable?

Yep.

Meanwhile you can use more than one Route Attribute on your Login/Error actions as follows:

[Route("ui/error", Name = "Error")]
[Route("home/error", Name = "HomeError")]
public async Task<IActionResult> Index(string errorId)
{
    var vm = new ErrorViewModel();

    if (errorId != null)
    {
        var message = await _interaction.GetErrorContextAsync(errorId);
        if (message != null)
        {
            vm.Error = message;
        }
    }

    return View("Error", vm);
}

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings