小编Col*_*lin的帖子

如何在 ASP.NET Core 中获取 Web Root Path 和 Content Root Path?

我正在尝试在视图中添加根路径作为参数,因此我可以将其作为参数传递给 PayPal 按钮。

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
    ... snip ...

    <input type="hidden" name="return" value="@Model.UrlRoot/Manage/Subscription?userId=@Model.User.Id">

    ... snip ...
</form>
Run Code Online (Sandbox Code Playgroud)

我正在筛选如何在 ASP.NET MVC 中获取我的 webapp 的基本 URL 中的答案 (20 个回答) 和 ASP.NET MVC 6 应用程序的虚拟应用程序根路径

由于 ASP.NET Core 完全不同,Request 类不再包含 .Url 属性,因此大多数答案都不起作用。

asp.net-core

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

asp.net-core ×1