kobake / AspNetCore.RouteAnalyzer

MIT License
88 stars 26 forks source link

Update for ASP.NET Core 3.x #26

Open ugumba opened 4 years ago

ugumba commented 4 years ago

Got something working for ASP.NET Core 3.x (see #25). I don't like the redirect. The browser's address bar shows the "internal" route, which is different from the original. Can anyone suggest a better way to accomplish this?

Packaging and docs have not been updated yet.

kingrichard2005 commented 3 years ago

See previous issue comment for details but consider removing references to HttpMethodActionConstraint since it's no longer publicly accessible in net 3+. Can replace with the following to get the same httpmethod metadata from the public EndpointMetadata property instead


    var httpMethodMetadata = _e.EndpointMetadata.Where(obj => obj is HttpMethodMetadata).FirstOrDefault();

    if (httpMethodMetadata != null)
    {
        var verbMethod = (httpMethodMetadata as HttpMethodMetadata).HttpMethods.FirstOrDefault();
        verb = verbMethod == null ? verb : verbMethod;
    }