dotnet/aspnetcore

UrlHelperExtensions.ActionLink docs are misleading regarding requiring protocol and host

已关闭

#42,949 创建于 2022年7月27日

 (2 条评论) (1 个反应) (0 位负责人)C# (10,653 个派生)batch import
Docsarea-routinghelp wanted

仓库指标

星标
 (37,933 个星标)
PR 合并指标
 (平均合并 16天 9小时) (30 天内合并 258 个 PR)

描述

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

the docs state

Generates an absolute URL if the protocol and host are non-null. See the remarks section for important security information.

but if you omit passing values or pass null it still generates an absolute URL, seeming based on the host header a request scheme of the request from http context https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.Core/src/UrlHelperExtensions.cs#L575

Expected Behavior

expect docs to not indicate absolute url requires thsoe params to be not null, should mention where it gets those values from if they are omitted or passed as null

Steps To Reproduce

n/a

Exceptions (if any)

n/a

.NET Version

6

Anything else?

No response

贡献者指南