Skip to content

IUrlHelper behave strange for new version of .net core 2.2 #4549

@Eilon

Description

@Eilon

From @benzhi2011 on Wednesday, 05 December 2018 15:00:37

IUrlHelper behave strange for new version of .net core 2.2

Helper method that is working for all early version

    public static string AbsoluteRouteUrl(
    this IUrlHelper url,
    string routeName,
    object routeValues = null)
    {
        return url.RouteUrl(routeName, routeValues, url.ActionContext.HttpContext.Request.Scheme);
     }

    string serviceUrl = Url.AbsoluteRouteUrl("default");

about one line of code return the Url of the executing MVC controller, in my case here it should return DNS + /Login/SSO and this code has been working for .core 1.1 and 2.1

After I updated to 2.2 this serviceUrl return DNS + /Contact/SSO when I call it from Login controller method SSO. This is really weird.

Copied from original issue: dotnet/core#2107

Metadata

Metadata

Assignees

Labels

area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesinvestigate

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions